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

Writing Detail and Trailer using SYNCSORT


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

New User


Joined: 08 Jun 2009
Posts: 36
Location: Bangalore

PostPosted: Wed Aug 18, 2010 9:47 pm
Reply with quote

Though I fetched many threads but could not find a solution

Input File has:

Header - 1st column = 0
Detail recs - 1st col = 1
Trailer - 1st column = 9

Code:
000100 0021720101326                           
000200 1A458746987456JKDJSJD7845T             
000300 1A3464587486HJDSFHJKFDGKHFDKK           
000400 1B3647845JKDGHJDFGHJDFGHJDFGHJ         
000500 1B3545433IEIEIJJHJHJDFGHJDFGHJ         
000600 1AJSDGSDKFKJ95794679KJDGJKDSFGJK       
000700 9        502172010                     


I need to have to output files.
Out file 1:
1) Should have header record as it is in Input file
2) Should have records with 1st col = 1 & 2nd column = 'A'
3) Trailer having count of records (Count should exclude header & trailer)

So it shud look like:

Code:
000100 0021720101326                           
000200 1A458746987456JKDJSJD7845T             
000300 1A3464587486HJDSFHJKFDGKHFDKK           
000400 1AJSDGSDKFKJ95794679KJDGJKDSFGJK
000500 000000003


Out file 2:
Out file 1:
1) Should have header record as it is in Input file
2) Should have records with 1st col = 1 & 2nd column = 'B'
3) Trailer having count of records (Count should exclude header & trailer)

I tried with the following Sort Card:

Code:
OPTION COPY
OUTFIL FNAMES=FILE1,INCLUDE=(1,1,CH,EQ,C'0',OR,1,1,CH,EQ,C'1',   
          AND,2,1,CH,EQ,C'A'),REMOVECC,TRAILER1=(COUNT-1=(M11,LENGTH=9))   
OUTFIL FNAMES=FILE2,INCLUDE=(1,1,CH,EQ,C'0',OR,1,1,CH,EQ,C'1',   
          AND,2,1,CH,EQ,C'B'),REMOVECC,TRAILER1=(COUNT-1=(M11,LENGTH=9))     



But this is giving syntax error:
Code:

WER268A  OUTFIL STATEMENT  : SYNTAX ERROR
WER268A  OUTFIL STATEMENT  : SYNTAX ERROR



PS: I am using SYNCSORT

ANy help would be much appreciated.

Thanks and regards,
Vivek
Back to top
View user's profile Send private message
Alissa Margulies

SYNCSORT Support


Joined: 25 Jul 2007
Posts: 496
Location: USA

PostPosted: Wed Aug 18, 2010 11:47 pm
Reply with quote

Hello Vivek.

Here are the SyncSort for z/OS control statements that should give you the requested output:
Code:
//SYSIN DD  *                                               
 SORT FIELDS=COPY                                           
 OUTFIL FILES=01,INCLUDE=(1,1,CH,EQ,C'0',OR,1,2,CH,EQ,C'1A'),
        REMOVECC,TRAILER1=(COUNT-1=(EDIT=(TTTTTTTTT)))       
 OUTFIL FILES=02,INCLUDE=(1,1,CH,EQ,C'0',OR,1,2,CH,EQ,C'1B'),
        REMOVECC,TRAILER1=(COUNT-1=(EDIT=(TTTTTTTTT)))       
/*                                                           
Back to top
View user's profile Send private message
viveksurya

New User


Joined: 08 Jun 2009
Posts: 36
Location: Bangalore

PostPosted: Thu Aug 19, 2010 2:17 pm
Reply with quote

Many thanks Alissa. It is working fine.

Just an additional query.

How can we have count in the Trailer written in Packed-Decimal format..??

I tried :

Code:
SORT FIELDS=COPY                                               
 OUTFIL FILES=01,INCLUDE=(1,1,CH,EQ,C'0',OR,1,2,CH,EQ,C'1A'), 
        REMOVECC,TRAILER1=(COUNT-1=PD)                         
 OUTFIL FILES=02,INCLUDE=(1,1,CH,EQ,C'0',OR,1,2,CH,EQ,C'1B'), 
        REMOVECC,TRAILER1=(COUNT-1=PD)                         



But this is giving syntax error.


Thanks and regards,
Vivek
Back to top
View user's profile Send private message
Alissa Margulies

SYNCSORT Support


Joined: 25 Jul 2007
Posts: 496
Location: USA

PostPosted: Thu Aug 19, 2010 8:18 pm
Reply with quote

Hello Vivek.

To convert the COUNT field to PD format, you must specify the length subparameter. Try the following:
Code:
TRAILER1=(COUNT-1=(PD,LENGTH=5))
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 only first records of the fil... SYNCSORT 7
No new posts Two input files & writing counter... DFSORT/ICETOOL 12
No new posts Insert trailer for non empty file only DFSORT/ICETOOL 6
No new posts AI writing DFSORT, REXX codes.. All Other Mainframe Topics 3
No new posts Comparing Header and Trailer. DFSORT/ICETOOL 7
Search our Forums:

Back to Top