View previous topic :: View next topic
Author
Message
VINAY PALLELA New User Joined: 28 Jan 2018Posts: 24 Location: India
Hi All,
Need help with the below requirement.
I have Below PARM in a JCL, which runs every month. Currently team is modifying this PARM every year manually in every February.
Please advice, If there a way to automate this to update every year without writing a program?
I have below sort to February 1st every year to update the parm file with current year. Facing problem with February month to get the Last day of month in
mmddyy format in column 6 to 11.
For testing, i am trying for the current month March and getting below output.
Could you please help me to correct the sort. Thank you in advance!
Pos - 01 to 02 -Month
Pos - 03 to 04 -Year
Pos - 06 to 11 - Last date of the month
Code:
//STEP010R EXEC PGM=SORT,COND=(4,LT)
//SYSOUT DD SYSOUT=*
//SORTLIB DD DSN=SYS1.SORTLIB,DISP=SHR
//SORTWK01 DD SPACE=(CYL,(10)),UNIT=SCRTCH
//SORTIN DD *
0124 013124
0224 022924
0324 033124
0424 043024
0524 053124
0624 063024
0724 073124
0824 083124
0924 093024
1024 103124
1124 113024
1224 123124
0125 013125
/*
//SYSIN DD *
OPTION COPY
INREC IFTHEN=(WHEN=INIT,
OVERLAY=(3:3,2,ZD,ADD,+1,TO=ZD,LENGTH=2,
10:10,2,ZD,ADD,+1,TO=ZD,LENGTH=2)),
IFTHEN=(WHEN=(1,2,CH,EQ,C'03'),
OVERLAY=(6:&DATE1,6,8,Y4T,LASTDAYM,TOGREG=Y2Y))
OUTREC OVERLAY=(3:3,2,ZD,EDIT=(TT),10:10,2,ZD,EDIT(TT))
/*
//SORTOUT DD SYSOUT=*
Output:
Code:
*****************************
0125 013125
0225 022925
0325 20240309 <
0425 043025
0525 053125
0625 063025
0725 073125
0825 083125
0925 093025
1025 103125
1125 113025
1225 123125
0126 013126
*****************************
Back to top
Joerg.Findeisen Senior Member Joined: 15 Aug 2015Posts: 1305 Location: Bamberg, Germany
Try this:
Code:
//WHATEVER EXEC PGM=SORT
//SORTIN DD *
WHATEVER
/*
//SYSOUT DD SYSOUT=*
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY,STOPAFT=1
INREC OVERLAY=(DATE2,5:2C'01')
OUTFIL FNAMES=(SORTOUT),
REMOVECC,REPEAT=13,
IFTHEN=(WHEN=INIT,
OVERLAY=(9:SEQNUM,2,ZD,START=0,
11:9,2,ZD,DIV,+12,ZD,LENGTH=2,
13:9,2,ZD,MOD,+12,ZD,LENGTH=2,
1:1,4,ZD,ADD,11,2,ZD,TO=ZD,LENGTH=4,
5,2,ZD,ADD,13,2,ZD,TO=ZD,LENGTH=2,
1:1,8,Y4T,LASTDAYM,TOGREG=(Y4T))),
IFTHEN=(WHEN=NONE,
BUILD=(5,2,3,2,X,5,2,7,2,3,2))
END
/*
It will print all for the current year, and first month of the next.
Code:
****** *********************
000001 0124 013124
000002 0224 022924
000003 0324 033124
000004 0424 043024
000005 0524 053124
000006 0624 063024
000007 0724 073124
000008 0824 083124
000009 0924 093024
000010 1024 103124
000011 1124 113024
000012 1224 123124
000013 0125 013125
****** *********************
Back to top
VINAY PALLELA New User Joined: 28 Jan 2018Posts: 24 Location: India
@Joerg.Findeisen: Thank you so much! Its working.
Back to top
Please enable JavaScript!