Repeatable header and trailer using sort

In this Mainframe Forum - You can post your queries on DFSORT, ICETOOL , SyncSort & JCL Utilities

Moderators: Frank Yaeger, Moderator Group

Post Reply
User avatar
magesh
Member
Posts: 5
Joined: Sat Jun 02, 2012 7:31 pm

Repeatable header and trailer using sort

Post by magesh » Sun Jun 03, 2012 6:38 am

Hi,

Need to a create header and trailer for every 254 records read from input file. I have a sequential file with list of dataset. using a skeleton copy JCL's are created. Now need to insert a repeatable header (Job Card) and trailer (// ) for every 254 step. Please find the below sample data.

Input : 80, FB

XXXXXXX.MAJORDS.ASDFATTB.D5010.G1293V00
XXXXXXX.MAJORDS.ASDFATTB.D5010.G1294V00
XXXXXXX.MAJORDS.ASDFATTB.D5010.G1295V00
XXXXXXX.MAJORDS.ASDFATTB.D5010.G1296V00
XXXXXXX.MAJORDS.ASDFATTB.D5010.G1297V00
XXXXXXX.MAJORDS.ASDFATTB.D5010.G1298V00
XXXXXXX.MAJORDS.ASDFATTB.D5010.G1299V00
XXXXXXX.MAJORDS.ASDFATTB.D5010.G1300V00
XXXXXXX.MAJORDS.ASDFATTB.D5010.G1301V00

Output: 80 FBA

Header(job card)
Filename1
.....
Filename200
trailer(// )
header(job card)
filename201
....
filename400
trailer(// )

Kindly help me in performing this using DFSORT. My shop is using syncsort.
_________________
magesh
magesh

NicC
Active Member
Posts: 650
Joined: Sun Jul 24, 2011 5:27 pm
Location: Down on the pig farm

Post by NicC » Sun Jun 03, 2012 7:11 am

If your shop is using syncsort why do you want a Dfsort solution?
Regards
Nic

User avatar
magesh
Member
Posts: 5
Joined: Sat Jun 02, 2012 7:31 pm

Post by magesh » Sun Jun 03, 2012 7:20 am

NicC wrote:If your shop is using syncsort why do you want a Dfsort solution?
Ok, Kindly provide me a solution for Syncsort.
magesh

DikDude
Moderator
Posts: 1001
Joined: Fri Jul 22, 2011 8:39 am
Location: usa

Post by DikDude » Sun Jun 03, 2012 8:19 am

Kindly help me in performing this using DFSORT
Ok, Kindly provide me a solution for Syncsort.
There is a Big difference between helping and actually doing the work for you. . .

You need to post what you have tried, what happened, and where you are stuck. Then we can help.
Have a good one

User avatar
magesh
Member
Posts: 5
Joined: Sat Jun 02, 2012 7:31 pm

Post by magesh » Sun Jun 03, 2012 9:34 am

Code: Select all

//SYSIN    DD  *                                                        
  SORT FIELDS=COPY                                                      
  OUTFIL FNAMES=REPORT,LINES=255,REMOVECC,                              
  HEADER2=(C'//TFT156@@ JOB 0000,COPY DSNS,CLASS=H,MSGCLASS=X,',/,      
           1:C'//         NOTIFY=&SYSUID,REGION=0M,TYPRUN=SCAN'),       
  OUTREC=(C'//SORT',7:SEQNUM,4,ZD,START=00,INCR=01,                     
      11:C' ',12:C'EXEC',16:C' ',                                       
      17:C'PGM=SORT',/,1:C'//SYSOUT   DD SYSOUT=*',/,                   
      1:C'//SYSOUT   DD SYSOUT=*',/,1:C'//SYSPRINT DD SYSOUT=*',        
      /,1:C'//SYSABEND DD DUMMY',/,1:C'//SORTIN   DD DISP=SHR,',        
      24:C'DSN=',1,44,SQZ=(SHIFT=LEFT,MID=C'(0)'),/,                    
      1:C'//SORTOUT  DD DSN=',1,44,SQZ=(SHIFT=LEFT,MID=C'.TESTCOPY,'),  
      /,1:C'//         DISP=(NEW,CATLG,DELETE),',/,1:C'//         LIKE=-
      ',1,44,SQZ=(SHIFT=LEFT,MID=C'(0),'),/,1:C'//         UNIT=VTAPE', 
      /,1:C'//         LABEL=RETPD=&RETPD,',/,1:C'//         VOL=(,,,50-
      )',/,1:C'//* '),                                                  
  TRAILER2=(C'//           ')                                           
/*                                                                      
With the above, I'm able to create the required output. Now, I'm trying to write a header after 254 input read from input file. Tried achiving with LINES=N, but the max value for n is 255. where in STEP0255 ends at 3369 line number.
magesh

Anuj Dhawan
Moderator
Posts: 1625
Joined: Sat Aug 09, 2008 9:02 am
Location: Mumbai, India

Post by Anuj Dhawan » Mon Jun 04, 2012 7:16 pm

but the max value for n is 255. where in STEP0255 ends at 3369 line number.
I'm not sure if I understood it, what does it mean?
Regards,
Anuj

DikDude
Moderator
Posts: 1001
Joined: Fri Jul 22, 2011 8:39 am
Location: usa

Post by DikDude » Mon Jun 04, 2012 11:15 pm

The goal is to generate a set of sort JCL/Control Statements for each record in the input file. Each record contains the DSN to be used in that sort step.At the beginning should be a header and after each 254 "sets", generate a new header.

As i read the posted outrec info, the disps are not what is used.

What does the curent output look like?

But, maybe i misunderstand.
Have a good one

User avatar
magesh
Member
Posts: 5
Joined: Sat Jun 02, 2012 7:31 pm

Post by magesh » Tue Jun 05, 2012 8:29 am

Hi DikDude,
Your are correct in terms of explaining the goal, Thanks. Please find the below for how the Output looks like.

Code: Select all

//TFT156@@ JOB 0000,COPYDSNS,CLASS=H,MSGCLASS=X,                        
//         NOTIFY=&SYSUID,REGION=0M,TYPRUN=SCAN                         
//SORT0000 EXEC PGM=SORT                                                
//SYSOUT   DD SYSOUT=*                                                  
//SYSOUT   DD SYSOUT=*                                                  
//SYSPRINT DD SYSOUT=*                                                  
//SYSABEND DD DUMMY                                                     
//SORTIN   DD DISP=SHR,DSN=TFT156.MAJORDS.ASDFATTB.D5010(0)             
//SORTOUT  DD DSN=TFT156.MAJORDS.ASDFATTB.D5010.TESTCOPY,               
//         DISP=(NEW,CATLG,DELETE),                                     
//         LIKE=TFT156.MAJORDS.ASDFATTB.D5010(0),                       
//         UNIT=VTAPE,                                                  
//         LABEL=RETPD=&RETPD,                                          
//         VOL=(,,,50)                                                  
//SYSIN   DD  *                                                         
   SORT FIELDS=COPY                                                     
/*                                                                      
//*                                                                     
As I mentioned earlier Header (job card) is repeated for every 255 line. Goal is to acheieve a Header (job card) for every 255 input record read from input rather than 255 line number on the output file.
magesh

NicC
Active Member
Posts: 650
Joined: Sun Jul 24, 2011 5:27 pm
Location: Down on the pig farm

Post by NicC » Tue Jun 05, 2012 11:54 am

Why 2 SYSOUT statements? Why a SYSABEND statement (I do not know if sort requires it)? Why a LIKE parameter - sort will sort out the dcb for you? Your &RETPD will cause a JCL error as you do not resolve it anywhere i.e. ther is no SET statement.
Regards
Nic

Post Reply

FREE TUTORIALS

Tutorials
Free tutorials from mainframegurukul
  • JCL Tutorial
    Covers all important JCL concepts.
  • Cobol Tutorial
    This tutorials covers all Cobol Topics from STRING to COMP-3.
  • DB2 Tutorial
    DB2 Tutorial focuses on DB2 COBOL Programming.
  • SORT Tutorial
    This Tutorial covers all important aspects of DFSORT with examples
  • CICS Tutorial
    This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions



Other References
Mainframe Tools and others