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 

Include input date in filename and in Header and trailer

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
chandra
Beginner


Joined: 26 Sep 2003
Posts: 130
Topics: 36

PostPosted: Wed Mar 24, 2010 5:04 pm    Post subject: Include input date in filename and in Header and trailer Reply with quote

Hi All,

I need to achive the following tasks using SORT or any other utility.

My Input file is FB and LRECL is 511 (it is in STEP020)

1.I want to include the date from input dataset into the Headers and also the run date and time in the header
2.I want to include only the count of 'BPR' records (Start position is 1 and length 3) in the Trailer 2. I don't want leading zeros or space in the count.
3.The out put dataset name in STEP020 should be created with TEST.DYYMMDD (YYMMDD will be the date from input file).

I have completed the task 1 and part of task 2 using SORT I don't know how to include only count of BPR in trailer 2 (as of now I am including count of all records with leading spaces, I don't want leading spaces).

For task 3 I know how to create a dataset name with system date and time by using the EZACFSM1 program and &LYYMMDD system variable but I don't know how to create a dataset with input date.

My sort steps are shown below.


Code:

//SORT10 EXEC  PGM=SORT
//SYSOUT    DD  SYSOUT=*
//SORTIN DD *
20100308
/*
//SORTOUT DD DSN=&&TEMP,
//           DISP=(,PASS),
//           UNIT=SYSDA,
//           SPACE=(TRK,(1,1))
//SYSIN    DD    *
  OPTION COPY
  OUTFIL REMOVECC,
    BUILD=(C'RUNDATE,''',1,8,C'''',80:X,/,
           C'PROCDATE,S''',C'&LYYMMDD&LHR&LMIN''',80:X)
/*
//SORT020 EXEC  PGM=SORT
//SYSOUT    DD  SYSOUT=*
//SYMNAMES DD DSN=&&TEMP,
//            DISP=(OLD,PASS)
//SORTIN DD *
ST*835*000000001~
BPR*I*4138.5*C*CHK************20100203~
TRN*1*1238561210*856390123480~
REF*AB*XYZ~
ST*835*000000002~
BPR*I*856.5*C*CHK************20100203~
TRN*1*1254638561210*8563GSDFG90123480~
REF*AB*XerteYZ~
ST*835*000000003~
BPR*I*4565138.5*CC*CHK************20100203~
TRN*1*12465638561210*85636573490123480~
REF*AEB*RTRXYZ~
/*
//SORTOUT DD SYSOUT=*
//SYSIN    DD    *
  OPTION COPY
  OUTFIL REMOVECC,
    HEADER1=('ISA*010*          *010*          *330*334290123480      ',
     '*ZZ*XYZ CORP       *',PROCDATE,'*U*00401*A',
     RUNDATE,'*0*P*:~',511:X),
    HEADER2=('GS*HP*390123480      *XYZ CORP       *',PROCDATE,
             '*1*X*004010X091A1~',511:X),
    TRAILER2=('GE*',COUNT=(EDIT=(IIIIIIIIIT)),'*A',RUNDATE,'~',511:X),
    TRAILER1=('IEA*1*A',RUNDATE,'~',511:X)
/*
//*

_________________
Regards,
Chandra
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Wed Mar 24, 2010 6:28 pm    Post subject: Reply with quote

chandra,

Why do you need the first additional step to create the symbols? You can do it all in one step.

The following DFSORT/ EZACFSM1 JCL will do all you wanted as well as create the output dataset as userid.Dyymmdd.Thhmmss

Change the following in the EZACFSM1 step
Code:

//SYSOUT   DD SYSOUT=*


to
Code:

//SYSOUT   DD SYSOUT=(*,INTRDR),RECFM=FB,LRECL=80   


After you have verified that the created JCL is right.


Code:

//STEP0100 EXEC PGM=EZACFSM1
//SYSOUT   DD SYSOUT=*
//SYSIN    DD DATA,DLM=@@                         
//USERIDA  JOB (,1722),                           
//             'Your Name',                       
//             CLASS=A,                           
//             MSGCLASS=Y,                       
//             MSGLEVEL=(1,1),                   
//             NOTIFY=USERID
//*
//STEP0100 EXEC PGM=SORT       
//SYSOUT   DD SYSOUT=*         
//SYMNAMES DD *                 
RUNDATE,C'20100308'             
PROCDATE,S'&LYYMMDD&LHR&LMIN'   
//SORTIN   DD DSN=Your input FB LRECL 511 file,DISP=SHR
//SORTOUT  DD DSN=USERID.D&LYYMMDD..T&LHHMMSS,                         
//            DISP=(NEW,CATLG,DELETE),                                 
//            UNIT=SYSDA,                                               
//            SPACE=(CYL,(X,Y),RLSE)                                   
//SYSIN    DD *                                                         
  OPTION COPY                                                     
  INREC IFTHEN=(WHEN=(1,3,CH,EQ,C'BPR'),                               
  OVERLAY=(512:SEQNUM,10,ZD,C'*A',RUNDATE,C'~'),HIT=NEXT),             
  IFTHEN=(WHEN=(1,3,CH,EQ,C'BPR'),                                     
  OVERLAY=(512:512,10,ZD,M10,LENGTH=10,                                 
           512:512,21,JFY=(SHIFT=LEFT)))                               
                                                                       
  OUTREC IFTHEN=(WHEN=GROUP,BEGIN=(512,1,CH,GT,C' '),PUSH=(512:512,21))
                                                                       
  OUTFIL REMOVECC,BUILD=(1,511),                                       
  HEADER1=(01:'ISA*010*',19:'*010*',                                   
           34:'*330*334290123480*ZZ*XYZ CORP       *',                 
           PROCDATE,'*U*00401*A',RUNDATE,'*0*P*:~'),                   
                                                                       
  HEADER2=(01:'GS*HP*390123480',23:'*XYZ CORP       *',                 
           PROCDATE,'*1*X*004010X091A1~'),                             
                                                                       
  TRAILER2=('GE*',512,21),                                             
                                                                       
  TRAILER1=('IEA*1*A',RUNDATE,'~')                                     
//*                                                                     
@@                           

_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
chandra
Beginner


Joined: 26 Sep 2003
Posts: 130
Topics: 36

PostPosted: Wed Mar 24, 2010 6:55 pm    Post subject: Reply with quote

Hi Kolusu,

Thanks for the reply.

I have used my first step to get the date from the input file and it looks as follows, this date will be changing every day so I don't want to hard code this date in my step.

Quote:

201003233MARCH 08208220100323NNN3MARCH


For Task 3 I want to use the input file date rather than the system date because my job might run any time depending on dependies for this job. Can we do that with EZACFSM1 ?
_________________
Regards,
Chandra
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Wed Mar 24, 2010 7:06 pm    Post subject: Reply with quote

chandra wrote:
For Task 3 I want to use the input file date rather than the system date because my job might run any time depending on dependies for this job. Can we do that with EZACFSM1 ?


Chandra,

Your input date is 8 bytes and you canNOT define the dataset with one of the qualifier starting with a numeric. In your requirement you wanted userid.RUNDATE. You need to have an alphabet as a prefix in qualifier. So come up with a good naming convention for the output dataset

If you are ok with creating the dataset as USERID.Yaaaa.Mbb.Dcc (where aaaa = 4 digit year from position 1 for 4 bytes in your input run date file, bb = mm from position 5 for 2 bytes in your input run date file and cc = dd from position 7 for 2 bytes in your input run date file) then use the following DFSORT JCL

Code:
//SORT10   EXEC PGM=SORT                                               
//SYSOUT   DD SYSOUT=*                                                 
//SORTIN   DD DSN=Your input run date FB lrecl 80 byte file,
//            DISP=SHR
//OUTDSN   DD DSN=&&D,DISP=(,PASS),SPACE=(TRK,(1,1),RLSE)             
//SYMBOLS  DD DSN=&&S,DISP=(,PASS),SPACE=(TRK,(1,1),RLSE)             
//SYSIN    DD *                                                       
  OPTION COPY,STOPAFT=1                                               
  OUTFIL FNAMES=OUTDSN,                                               
  BUILD=(C'//SORTOUT  DD DSN=USERID.Y',1,4,C'.M',5,2,C'.D',7,2,C',',/,
         C'//            DISP=(NEW,CATLG,DELETE),',/,                 
         C'//            UNIT=SYSDA,',/,                               
         C'//            SPACE=(CYL,(X,Y),RLSE)',/,C'//*',80:X)       
                                                                       
  OUTFIL FNAMES=SYMBOLS,                                               
  BUILD=(C'//SYMNAMES DD *',/,                                         
         C'RUNDATE,C''',1,8,C'''',/,                                   
         C'PROCDATE,S''',C'&LYYMMDD&LHR&LMIN''',/,C'//*',80:X)         
//*                 
//STEP0100 EXEC PGM=SORT                                               
//SYSOUT   DD SYSOUT=*                                                 
//SORTOUT  DD SYSOUT=*                                                 
//SYSIN    DD *                                                         
  SORT FIELDS=COPY                                                     
//SORTIN   DD DATA,DLM=@@                                               
//USERIDB  JOB (,????),                                                 
//             'your name',
//             CLASS=A,                                                 
//             MSGCLASS=Y,                                             
//             MSGLEVEL=(1,1),                                         
//             NOTIFY=USERID                                           
//*                                                                     
//STEP0100 EXEC PGM=SORT                                               
//SYSOUT   DD SYSOUT=*                                                 
//SORTIN   DD DSN=YOUR INPUT LRECL 511 FILE,DISP=SHR                   
//SYSIN    DD *                                                         
  SORT FIELDS=COPY                                                     
  INREC IFTHEN=(WHEN=(1,3,CH,EQ,C'BPR'),                               
  OVERLAY=(512:SEQNUM,10,ZD,C'*A',RUNDATE,C'~'),HIT=NEXT),             
  IFTHEN=(WHEN=(1,3,CH,EQ,C'BPR'),                                     
  OVERLAY=(512:512,10,ZD,M10,LENGTH=10,                                 
           512:512,21,JFY=(SHIFT=LEFT)))                               
                                                                       
  OUTREC IFTHEN=(WHEN=GROUP,BEGIN=(512,1,CH,GT,C' '),PUSH=(512:512,21))
                                                                       
  OUTFIL REMOVECC,BUILD=(1,511),                                       
  HEADER1=(01:'ISA*010*',19:'*010*',                                   
           34:'*330*334290123480*ZZ*XYZ CORP       *',                 
           PROCDATE,'*U*00401*A',RUNDATE,'*0*P*:~'),                   
                                                                       
  HEADER2=(01:'GS*HP*390123480',23:'*XYZ CORP       *',                 
           PROCDATE,'*1*X*004010X091A1~'),                             
                                                                       
  TRAILER2=('GE*',512,21),                                             
                                                                       
  TRAILER1=('IEA*1*A',RUNDATE,'~')                                     
//*                                                                     
@@     
//         DD DSN=&&D,DISP=(OLD,PASS)     
//         DD DSN=&&S,DISP=(OLD,PASS)     
//*

_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
chandra
Beginner


Joined: 26 Sep 2003
Posts: 130
Topics: 36

PostPosted: Thu Mar 25, 2010 2:29 pm    Post subject: Reply with quote

Hi Kolusu,

Thank you very much... It is working perfectly.


Thanks,
Chandra
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities 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