Hi All,
I need to add a Header and Trailer to a file(GDG) using SORT. The header needs to have a sequence number of 4 digits, example 0001.
Each time job runs this sequence number should be incremented by 1.
The file is FB file with LRECL 536, and sequence number should be at col 47 - 50.
Kindly suggest me any ideas as how we can have a number incremented at header based on job run.
If the above is not possible, can we have the previous version of GDG file included in SORTIN and read its seq number alone,
and increment the new seq number in the current version of file?
Please let me know if I have failed to put any information which is important.
Regards
Incrementing a sequence number in Header for each Job Run
-
- Global moderator
- Posts: 3805
- Joined: Tue Jan 25, 2011 12:02 am
- Skillset: Easytrieve Plus, Cobol, Utilities, that sort of stuff
- Referer: Google
Re: Incrementing a sequence number in Header for each Job Ru
If you have information like this (a sequence number/date/something) for a file header, it is best stored on a separate dataset, and maintained at the beginning of each run. Then it is simple to just use it, without having updates to the information in multiple places.
So, imagining you have a single-record file with the data ready on it, it is a simple thing to have one Sort step generate a DFSORT symbol/SYMNAME for the information, and that symbol/SYMNAME to be used in the next step doing the actual processing. For multiple jobs, generate the symbol/SYMNAME and include it as required in whatever Sort steps you need.
There are examples, but before the code, you need to decide on your source of the data. If you are unable to go the "proper" route, you can take it from the previous generation of your dataset, using STOPAFT=1, in the same style as outlined, but it is much more tacky and error-prone.
So, imagining you have a single-record file with the data ready on it, it is a simple thing to have one Sort step generate a DFSORT symbol/SYMNAME for the information, and that symbol/SYMNAME to be used in the next step doing the actual processing. For multiple jobs, generate the symbol/SYMNAME and include it as required in whatever Sort steps you need.
There are examples, but before the code, you need to decide on your source of the data. If you are unable to go the "proper" route, you can take it from the previous generation of your dataset, using STOPAFT=1, in the same style as outlined, but it is much more tacky and error-prone.
-
- Posts: 16
- Joined: Thu Dec 06, 2012 2:30 pm
- Skillset: COBOL, PL1, IMS DB-DC, JCL
- Referer: Internet
Re: Incrementing a sequence number in Header for each Job Ru
Hi Billy, I am extremely Thanksful for your reponse.
My header req is as below
POSITION DESCRIPTION
1-12 LITERAL 'HEADERREDAEH'
13-20 LITERAL 'OPRET ID'
21-46 YYYY-MM-DD-HH.MM.SS.000000
47-50 WHEN 9999, START OVER WITH 1
The previous version of GDG Looks like
1-----------------------------------------------------------------50
HEADERREDAEHOPERT ID2012-12-05-08.29.49.0000000002
5001 8142 2012-10-2500000000001 ACT 5001 20120112012-10-25
The current SORT Card to get this header is
OPTION COPY
OUTFIL REMOVECC,
HEADER1=('HEADERREDAEH','OPERT ID',DATE=(4MD-),'-',
&TIME=(24.),'.000000','0002'),
TRAILER1=('TRAILERRELIART','OPERT ID',COUNT=(M11,LENGTH=8))
Could you please guide me thru the better option using symbol/SYMNAME, I understand am bit over demanding but I would be thankful if
you could provide me an example to use SYMNAME for above req.
Regards.
My header req is as below
POSITION DESCRIPTION
1-12 LITERAL 'HEADERREDAEH'
13-20 LITERAL 'OPRET ID'
21-46 YYYY-MM-DD-HH.MM.SS.000000
47-50 WHEN 9999, START OVER WITH 1
The previous version of GDG Looks like
1-----------------------------------------------------------------50
HEADERREDAEHOPERT ID2012-12-05-08.29.49.0000000002
5001 8142 2012-10-2500000000001 ACT 5001 20120112012-10-25
The current SORT Card to get this header is
OPTION COPY
OUTFIL REMOVECC,
HEADER1=('HEADERREDAEH','OPERT ID',DATE=(4MD-),'-',
&TIME=(24.),'.000000','0002'),
TRAILER1=('TRAILERRELIART','OPERT ID',COUNT=(M11,LENGTH=8))
Could you please guide me thru the better option using symbol/SYMNAME, I understand am bit over demanding but I would be thankful if
you could provide me an example to use SYMNAME for above req.
Regards.
-
- Posts: 16
- Joined: Thu Dec 06, 2012 2:30 pm
- Skillset: COBOL, PL1, IMS DB-DC, JCL
- Referer: Internet
Re: Incrementing a sequence number in Header for each Job Ru
Thanks Billy for your time and help!
-
- Posts: 16
- Joined: Thu Dec 06, 2012 2:30 pm
- Skillset: COBOL, PL1, IMS DB-DC, JCL
- Referer: Internet
Re: Incrementing a sequence number in Header for each Job Ru
Hi,
I am trying to read the header of prev version of GDG File and increment the current version header as below
File 1 is prev version of file having header as
HEADERREDAEHOPERT ID2012-12-12-05.14.53.0000000001 ( From Col 1 to Col 50 )
File 2 is current version having header as ( From Col 1 to Col 46 )
HEADERREDAEHOPERT ID2012-12-12-05.14.53.000000
I need to read col 47 to 50 of File1 and update the same in File 2 at Col 47.
Please find the job below
//STEP0002 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=FILE1,DISP=SHR
//SORTOUT DD DSN=&&REM,
// DISP=(NEW,PASS,DELETE),
// DCB=(RECFM=FB,LRECL=80),
// SPACE=(TRK,(2000,300),RLSE)
//SYSIN DD *
OPTION COPY,NULLOUT=RC4
OUTREC BUILD=(C'SEQ,C''',47,4,C'''',80:X)
//*
//STEP0003 EXEC PGM=SORT,COND=(4,EQ,STEP0002)
//SYSOUT DD SYSOUT=*
//SYMNAMES DD DSN=&&REM,DISP=SHR
//SORTIN DD DSN=FILE2,DISP=SHR
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
INREC IFOUTLEN=536,IFTHEN=(WHEN=INIT,OVERLAY=(537:SEQNUM,8,PD)),
IFTHEN=(WHEN=(537,8,PD,EQ,1),OVERLAY=(47:SEQ))
//*
On executing this job am getting below error
WER466A -SYMNAMES ERRORS FOUND
WER466A indicates that errors were found in the symbols definitions in the SYMNAMES dataset
Kindly help to resolve the issue, is there a naming convention to be followed for symname dataset?
File 1 and File 2 are FB file, LRECL 536.
I am trying to read the header of prev version of GDG File and increment the current version header as below
File 1 is prev version of file having header as
HEADERREDAEHOPERT ID2012-12-12-05.14.53.0000000001 ( From Col 1 to Col 50 )
File 2 is current version having header as ( From Col 1 to Col 46 )
HEADERREDAEHOPERT ID2012-12-12-05.14.53.000000
I need to read col 47 to 50 of File1 and update the same in File 2 at Col 47.
Please find the job below
//STEP0002 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=FILE1,DISP=SHR
//SORTOUT DD DSN=&&REM,
// DISP=(NEW,PASS,DELETE),
// DCB=(RECFM=FB,LRECL=80),
// SPACE=(TRK,(2000,300),RLSE)
//SYSIN DD *
OPTION COPY,NULLOUT=RC4
OUTREC BUILD=(C'SEQ,C''',47,4,C'''',80:X)
//*
//STEP0003 EXEC PGM=SORT,COND=(4,EQ,STEP0002)
//SYSOUT DD SYSOUT=*
//SYMNAMES DD DSN=&&REM,DISP=SHR
//SORTIN DD DSN=FILE2,DISP=SHR
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
INREC IFOUTLEN=536,IFTHEN=(WHEN=INIT,OVERLAY=(537:SEQNUM,8,PD)),
IFTHEN=(WHEN=(537,8,PD,EQ,1),OVERLAY=(47:SEQ))
//*
On executing this job am getting below error
WER466A -SYMNAMES ERRORS FOUND
WER466A indicates that errors were found in the symbols definitions in the SYMNAMES dataset
Kindly help to resolve the issue, is there a naming convention to be followed for symname dataset?
File 1 and File 2 are FB file, LRECL 536.
-
- Global moderator
- Posts: 3805
- Joined: Tue Jan 25, 2011 12:02 am
- Skillset: Easytrieve Plus, Cobol, Utilities, that sort of stuff
- Referer: Google
Re: Incrementing a sequence number in Header for each Job Ru
Yes, there is a naming convention, and you also have "reserved words", you can't use the same name as something that SyncSort itself uses.
However, just run your first step, with SORTOUT going to SYSOUT=* (or whatever is your site standard).
However, just run your first step, with SORTOUT going to SYSOUT=* (or whatever is your site standard).
-
- Posts: 16
- Joined: Thu Dec 06, 2012 2:30 pm
- Skillset: COBOL, PL1, IMS DB-DC, JCL
- Referer: Internet
Re: Incrementing a sequence number in Header for each Job Ru
I just edited my job to have a File name declared, as File3 ( RECFM = FB, LRECL = 80 )
This job is going thru fine but is not appending the sequence number in File 2.
If you could kindly assist me where I am going wrong.
Code'd
Code: Select all
//STEP0002 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=FILE1,DISP=SHR
//SORTOUT DD DSN=FILE3,DISP=SHR
//SYSIN DD *
OPTION COPY,NULLOUT=RC4,STOPAFT=1
OUTREC BUILD=(C'SEQ,C''',47,4,C'''',80:X)
//*
//STEP0003 EXEC PGM=SORT,COND=(4,EQ,STEP0002)
//SYSOUT DD SYSOUT=*
//SYMNAMES DD DSN=FILE3,DISP=SHR
//SORTIN DD DSN=FILE2,DISP=SHR
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
INREC IFOUTLEN=536,IFTHEN=(WHEN=INIT,OVERLAY=(537:SEQNUM,8,PD)),
IFTHEN=(WHEN=(537,8,PD,EQ,1),OVERLAY=(47:SEQ))
//*
This job is going thru fine but is not appending the sequence number in File 2.
If you could kindly assist me where I am going wrong.
Code'd
-
- Posts: 16
- Joined: Thu Dec 06, 2012 2:30 pm
- Skillset: COBOL, PL1, IMS DB-DC, JCL
- Referer: Internet
Re: Incrementing a sequence number in Header for each Job Ru
Hi, Kindly ignore the prev message..I got the desired result.
Thanks for your help and time
Thanks for your help and time
-
- Global moderator
- Posts: 3805
- Joined: Tue Jan 25, 2011 12:02 am
- Skillset: Easytrieve Plus, Cobol, Utilities, that sort of stuff
- Referer: Google
Re: Incrementing a sequence number in Header for each Job Ru
Thanks for letting us know. The power of STOPAFT=1, rather than one identical symbol per record.
Is your file really that huge? You have a 15-digit sequence number. If you make it ZD, of a length greater than will ever be needed, you can change your test to a CHaracter comparison for 00000001, or whatever length, and pick up some CPU savings.
The SYMNAMES file probably has to be FB 80, but as far as I can see you had that with the temporary file.
Is your file really that huge? You have a 15-digit sequence number. If you make it ZD, of a length greater than will ever be needed, you can change your test to a CHaracter comparison for 00000001, or whatever length, and pick up some CPU savings.
The SYMNAMES file probably has to be FB 80, but as far as I can see you had that with the temporary file.
-
- Similar Topics
- Replies
- Views
- Last post
-
- 1
- 1255
-
by willy jensen
View the latest post
Sat Sep 04, 2021 12:51 am
-
-
compare number lines of two dataset
by samb01 » Wed Nov 13, 2024 8:46 pm » in DFSORT/ICETOOL/ICEGENER - 6
- 2129
-
by sergeyken
View the latest post
Fri Nov 15, 2024 12:41 pm
-