How to add (special character) ' in Input file using sort jc



IBM's flagship sort product DFSORT for sorting, merging, copying, data manipulation and reporting. Includes ICETOOL and ICEGENER

How to add (special character) ' in Input file using sort jc

Postby dkuma14 » Thu Oct 13, 2016 8:02 pm

Hello Everyone request you to help me on my below query.

I have searched the forum and I am getting sort card to add special character or any character in a file but I am not getting any how to add special character ' which is my requirement.

I have an Input file having below records (data starting from position 1)

1234567
1761241

I need my output as below after sort.
'1234567',
'1761241',


I used a jcl as below

//SYSIN DD *
SORT FIELDS=COPY
OUTREC FIELDS=(1:C';',2:1,7,C';,',800:X)

And In this case I am getting output as expected

Output -

;1234567;,
;1761241;,

But when I am using below ( for special character ' ) which actually I need at position 1 and 9 it is showing syntax error.

//SYSIN DD *
SORT FIELDS=COPY
OUTREC FIELDS=(1:C''',2:1,7,C'',',800:X)

Thanks
dkuma14
 
Posts: 18
Joined: Thu Oct 13, 2016 7:34 pm
Has thanked: 8 times
Been thanked: 0 time

Re: How to add (special character) ' in Input file using sor

Postby Aki88 » Thu Oct 13, 2016 8:51 pm

Hello,

To add a single quote, you write it as two single-quotes, so your SORT card changes to below (you can add the additional space padding code):


SORT FIELDS=COPY              
OUTFIL BUILD=(C'''',1,7,C''',')
 



Output:


'1234567',
'1761241',
 

These users thanked the author Aki88 for the post:
dkuma14 (Thu Oct 13, 2016 11:35 pm)
Aki88
 
Posts: 381
Joined: Tue Jan 28, 2014 1:52 pm
Has thanked: 33 times
Been thanked: 36 times

Re: How to add (special character) ' in Input file using sor

Postby Akatsukami » Thu Oct 13, 2016 8:55 pm

Welcome to the board.

As you will quickly learn, JCL does nothing but create environments in which programs can run, and then run those programs. You need (or at least want) a sort program. There are two fora for the major sort products, DFSORT and Syncsort (now called MFX). They have similar but not identical control syntax. I have moved your post to the DFSORT forum; if you are using MFX, I will move it to the Syncsort forum.

Note also that you ought to have given at least the error number and message; we are not clairvoyant. Better would be the entire SYSOUT spool data set (no, it's not a "file"; I use a file on the bars of my cell); that would tell us what sort product your shop uses.
Last edited by Akatsukami on Fri Oct 14, 2016 3:29 am, edited 1 time in total.
Reason: Keep leaving out whole
"You have sat too long for any good you have been doing lately ... Depart, I say; and let us have done with you. In the name of God, go!" -- what I say to a junior programmer at least once a day

These users thanked the author Akatsukami for the post:
dkuma14 (Thu Oct 13, 2016 11:33 pm)
User avatar
Akatsukami
Global moderator
 
Posts: 1058
Joined: Sat Oct 16, 2010 2:31 am
Location: Bloomington, IL
Has thanked: 6 times
Been thanked: 51 times

Re: How to add (special character) ' in Input file using sor

Postby dkuma14 » Thu Oct 13, 2016 9:11 pm

Thanks !! It's working fine :)
dkuma14
 
Posts: 18
Joined: Thu Oct 13, 2016 7:34 pm
Has thanked: 8 times
Been thanked: 0 time

Re: How to add (special character) ' in Input file using sor

Postby dkuma14 » Thu Oct 13, 2016 11:27 pm

I need one more help . In above requirement what will be the sort card if I don't want , at the end of my last record .

Note : I will be not aware about how many records will be there in the Input file. Is there any way to do this through Sort Jcl?

Here below what I am expecting .

Input
1234567
1761241
5611131


Output
'1234567',
'1761241',
'5611131'

Request you to provide sort Jcl for this.
dkuma14
 
Posts: 18
Joined: Thu Oct 13, 2016 7:34 pm
Has thanked: 8 times
Been thanked: 0 time

Re: How to add (special character) ' in Input file using sor

Postby dkuma14 » Thu Oct 13, 2016 11:39 pm

I need one more help . In above requirement what will be the sort card if I don't want , at the end of my last record .

Note : I will be not aware about how many records will be there in the Input file. Is there any way to do this through Sort Jcl?

Here below what I am expecting .

Input
1234567
1761241
5611131


Output
'1234567',
'1761241',
'5611131'

Request you to provide sort Jcl for this.


Thanks
dkuma14
 
Posts: 18
Joined: Thu Oct 13, 2016 7:34 pm
Has thanked: 8 times
Been thanked: 0 time

Re: How to add (special character) ' in Input file using sor

Postby Aki88 » Fri Oct 14, 2016 2:06 am

Various solutions to the problem; look here for starters; ignore the portion about SYNCSORT, try and understand the logic given in the SORT card.
Build your logic around this, if you face an error, post it here and we can guide you further.

These users thanked the author Aki88 for the post:
dkuma14 (Fri Oct 14, 2016 4:00 am)
Aki88
 
Posts: 381
Joined: Tue Jan 28, 2014 1:52 pm
Has thanked: 33 times
Been thanked: 36 times

Re: How to add (special character) ' in Input file using sor

Postby dkuma14 » Fri Oct 14, 2016 4:01 am

Thanks Aki ... I gone through the link suggested by you above and its worked for me. Thanks a lot
dkuma14
 
Posts: 18
Joined: Thu Oct 13, 2016 7:34 pm
Has thanked: 8 times
Been thanked: 0 time


Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post