MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Creating dataset with Header and Trailer.

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Job Control Language(JCL)
View previous topic :: View next topic  
Author Message
tvssv
Beginner


Joined: 11 Mar 2009
Posts: 58
Topics: 25

PostPosted: Sat Jul 04, 2020 3:08 am    Post subject: Creating dataset with Header and Trailer. Reply with quote

Hi,

I have file as below.
Code:

----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----
*********************************************************** Top of Data **********************
AADFWFJ NANHKG CLEYMK0391HKNNYEH/KUEILIN         00220200527202006171DAUSAMERICAN AIRLINES-DFW
AADFWFJ NANAPW EIPHVO0853HKNNYEH/KUEILIN         00220200527202006121DAUSAMERICAN AIRLINES-DFW
AADFWFJ HKGNAN EIPHVO0392HKNNYEH/KUEILIN         00220200527202006111DAUSAMERICAN AIRLINES-DFW
AADFWFJ APWNAN CLEYMK0254HKNNYEH/KUEILIN         00220200527202006151DAUSAMERICAN AIRLINES-DFW
AAHKGFJ NANAKL LPMZNO0411SSNNIAO/KEVIN KEIKEI MR/00220200512202007190DAHKAMERICAN AIRLINES-HKG
AAHKGFJ HKGNAN SOSYDH0392HKTKIAO/KEVIN KEIKEI MR 00120200526202008081DAHKAMERICAN AIRLINES-HKG


Having year and day field at 53-58 locations.

I need to create output file as below.
Code:

H        202005                                                                                 
AADFWFJ NANHKG CLEYMK0391HKNNYEH/KUEILIN         00220200527202006171DAUSAMERICAN AIRLINES-DFW 
AADFWFJ NANAPW EIPHVO0853HKNNYEH/KUEILIN         00220200527202006121DAUSAMERICAN AIRLINES-DFW 
AADFWFJ HKGNAN EIPHVO0392HKNNYEH/KUEILIN         00220200527202006111DAUSAMERICAN AIRLINES-DFW 
AADFWFJ APWNAN CLEYMK0254HKNNYEH/KUEILIN         00220200527202006151DAUSAMERICAN AIRLINES-DFW 
AAHKGFJ NANAKL LPMZNO0411SSNNIAO/KEVIN KEIKEI MR/00220200512202007190DAHKAMERICAN AIRLINES-HKG 
AAHKGFJ HKGNAN SOSYDH0392HKTKIAO/KEVIN KEIKEI MR 00120200526202008081DAHKAMERICAN AIRLINES-HKG 
AAHKGFJ AKLNAN ERSLFG0410HKTKIAO/KEVIN KEI KEI/NI00220200512202008091DAHKAMERICAN AIRLINES-HKG 
98AI FJ BNENAN CLULFN0920TKTKFORSTER/ZACHARY BRIA00220200525202008090DCGBSOUTHALL TRAVEL
98AI FJ BNENAN QRNDGQ0922TKTKSULSKIS/LAURA MS    00120200511202008080DCGBSOUTHALL TRAVEL
T        000023152                                                                     


Header as 'H and year&date from 1st record 53-58 location and Trailer should have the count excluding Header and Trailer.

Input and Output files are of RECFM=FB,LRECL=282.

I have coded the below jcl
Code:

//SID26505 EXEC PGM=SORT,REGION=2M                               
//*                                                             
//SORTIN   DD   DSN=E861559.SIDT.BIDTFJ.MAY20,DISP=SHR           
//SORTOUT  DD   DSN=E861559.SIDT.SID3HC.TMP,DISP=(,CATLG),       
//             RECFM=FB,LRECL=282,                               
//             DATACLAS=LARGE,STORCLAS=SCPRIME                   
//SYSIN    DD   *                                               
  OPTION COPY                                                   
  OUTFIL REMOVECC,                                               
  TRAILER1=(1:'T',10:COUNT=(M11,LENGTH=10))                     
//*                                                             


Able to create Trailer as below.
Code:

96BH FJ SYDNAN IEXGNJ0910TKTKMIRITELLO SANTORO/MA00420200519202008151DCBRHIGH LIGHT VIAGENS E TURISMO
96BH FJ SYDNAN IEXGNJ0910TKTKMIRITELLO SANTORO/MA00420200512202008150DCBRHIGH LIGHT VIAGENS E TURISMO
96BH FJ NANSYD IEXGNJ0911HKNNMIRITELLO SANTORO/MA00420200519202007281DCBRHIGH LIGHT VIAGENS E TURISMO
98AI FJ BNENAN CLULFN0920TKTKFORSTER/ZACHARY BRIA00220200525202008090DCGBSOUTHALL TRAVEL - JETABROAD 
98AI FJ BNENAN QRNDGQ0922TKTKSULSKIS/LAURA MS    00120200511202008080DCGBSOUTHALL TRAVEL - JETABROAD 
T        0000023152                                                                                   


Please help me out with the below requirement.

1. How to create Header as 'H year & Date picking from 1st record'.
2. If file is empty how to create Header & Trailer.
Header as "H year and day should be system date as 202004 (today date)". That is it should be JOB run system date. And trailer as 'T 0000'.

Please help with sysin steps.

Thank You.
_________________
Thanks
TVSSV
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12354
Topics: 75
Location: San Jose

PostPosted: Sat Jul 04, 2020 11:09 am    Post subject: Reply with quote

tvssv,

Use the following untested DFSORT JCL

Code:

//STEP0100 EXEC PGM=SORT                                       
//SYSOUT   DD SYSOUT=*                                         
//SORTIN   DD DISP=SHR,DSN=&&INP                               
//SORTOUT  DD DSN=Your output file,                     
//            DISP=(NEW,CATLG,DELETE),                         
//            SPACE=(CYL,(X,Y),RLSE)                           
//SYSIN    DD *                                               
  OPTION COPY                                                 
  OUTFIL NULLOFL=RC4,REMOVECC,                                 
  HEADER1=(1:'H',10:53,6),                                     
  TRAILER1=(1:'T',10:COUNT=(M11,LENGTH=10))                   
/*                                                             
//STEP0200 EXEC PGM=SORT,COND=(0,EQ,STEP0100)                 
//SYSOUT   DD SYSOUT=*                                         
//SYMNAMES DD *                                               
CURRDAY,S'&LYR4.&LDAY'                                         
//SORTIN   DD DUMMY,DCB=(LRECL=282,RECFM=FB,BLKSIZE=0,DSORG=PS)
//SORTOUT  DD DISP=OLD,DSN=Same output file from step0100 
//SYSIN    DD *                                               
  OPTION COPY                                                 
  OUTFIL REMOVECC,                                             
  HEADER1=(1:'H',10:CURRDAY),                                 
  TRAILER1=(1:'T',10:COUNT=(M11,LENGTH=10))                   
/*

_________________
Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort

www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Job Control Language(JCL) All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group