IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

SYNCSORT to format the input file


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
rajasekarme

New User


Joined: 06 May 2006
Posts: 3
Location: Chennai

PostPosted: Tue Mar 03, 2009 12:27 am
Reply with quote

I need to format the input file as below.

Below is the manual process:

1. 'C on blank line ‘ ‘, (10 spaces between quotes)
2. ‘oo’ on first line to copy quotes and comma
3. 'oo’ on last line to copy quotes and comma
4. TF80 - to move a single set of SE’s pre-line to FIVE line-across
5. Edit with "(" in the first input and number and ") with ur" in the
last line

Code:
 

Input file
9500010913
9500015516
9500018049
9500018452
9500018460
9500010914
9500015515
9500018046
9500018457
9500018468

Need output as:

('9500010913', '9500015516', '9500018049', '9500018452', '9500018460',
'9500010914', '9500015515', '9500018046', '9500018457') WITH UR;     
 


This formated output will be used as an input to the SQL query coming in the next step.

Raj
Back to top
View user's profile Send private message
Sachinrethin

New User


Joined: 12 Oct 2007
Posts: 21
Location: Chennai

PostPosted: Tue Mar 03, 2009 10:10 am
Reply with quote

Hi,

Try this code , i hope it helps!

INREC BUILD=(1:C'''',2:1,10,12:C''',',67X,81:SEQNUM,8,ZD)
SORT FIELDS=(81,8,CH,D)
OUTREC IFTHEN=(WHEN=(88,1,ZD,EQ,1),BUILD=(1,12,13:C' ',67X)),
IFTHEN=(WHEN=NONE,BUILD=(1,80))
OUTFIL REMOVECC,HEADER1=(1:'('),
TRAILER1=(') WITH UR;')
Back to top
View user's profile Send private message
Sachinrethin

New User


Joined: 12 Oct 2007
Posts: 21
Location: Chennai

PostPosted: Tue Mar 03, 2009 10:11 am
Reply with quote

Hi ,


the output of the above sort card is,

(
'9500018468',
'9500018457',
'9500018046',
'9500015515',
'9500010914',
'9500018460',
'9500018452',
'9500018049',
'9500015516',
'9500010913'
) WITH UR;
Back to top
View user's profile Send private message
rajasekarme

New User


Joined: 06 May 2006
Posts: 3
Location: Chennai

PostPosted: Tue Mar 03, 2009 12:24 pm
Reply with quote

Thanks Sachin, the above code helps me. Since I am supplying huge input numbers I prefer the TF80 format, (i.e) five input numbers a row. Like the one I displayed as expected output.

Thanks
Raj
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Tue Mar 03, 2009 2:41 pm
Reply with quote

rajasekarme,

This is one way of achieving it. Note that I have used two dummy values for the first and last values. Make sure there are no such values existing in the table. Good luck icon_smile.gif
Code:
//STEP1    EXEC PGM=SYNCTOOL                                         
//TOOLMSG  DD SYSOUT=*                                               
//DFSMSG   DD SYSOUT=*                                               
//IN       DD DSN= Input  file                                       
//OUT      DD DSN= Output file                                       
//TOOLIN   DD *                                                       
 SPLICE FROM(IN) TO(OUT) ON(97,8,CH) WITHEACH KEEPNODUPS -           
 WITH(25,13) WITH(38,13) WITH(51,13) WITH(64,13) USING(CTL1)         
//CTL1CNTL DD *                                                       
 INREC IFTHEN=(WHEN=INIT,                                             
       OVERLAY=(81:SEQNUM,8,ZD,89:81,8,ZD,MOD,+5,M11,LENGTH=8)),     
 IFTHEN=(WHEN=(89,8,ZD,EQ,1),OVERLAY=(12:C'''',1,10,C''','),HIT=NEXT),
 IFTHEN=(WHEN=(89,8,ZD,EQ,2),OVERLAY=(25:C'''',1,10,C''','),HIT=NEXT),
 IFTHEN=(WHEN=(89,8,ZD,EQ,3),OVERLAY=(38:C'''',1,10,C''','),HIT=NEXT),
 IFTHEN=(WHEN=(89,8,ZD,EQ,4),OVERLAY=(51:C'''',1,10,C''','),HIT=NEXT),
 IFTHEN=(WHEN=(89,8,ZD,EQ,0),OVERLAY=(64:C'''',1,10,C''',',           
                                      89:C'00000005'),HIT=NEXT),     
 IFTHEN=(WHEN=ANY,OVERLAY=(97:81,8,ZD,SUB,89,8,ZD,M11,LENGTH=8))     
 OUTFIL BUILD=(12,65,80:X),REMOVECC,                                 
        HEADER1=('(''FFFFFFFFFF'','),                                 
        TRAILER1=('''LLLLLLLLLL'')')
Back to top
View user's profile Send private message
rajasekarme

New User


Joined: 06 May 2006
Posts: 3
Location: Chennai

PostPosted: Wed Mar 04, 2009 12:09 am
Reply with quote

Hi Arcvns,

Thanks a lot, the code you have suggested is working fine with my requirement. Those dummy header/trailer numbers will never be in our table, hence no problem in using them. Thanks again icon_biggrin.gif

Raj
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Wed Mar 04, 2009 12:16 am
Reply with quote

rajasekarme,

You're welcome. Good to hear it's working for you icon_smile.gif
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts TRIM everything from input, output co... DFSORT/ICETOOL 1
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
Search our Forums:

Back to Top