Incrementing a sequence number in Header for each Job Run



Support for NetApp SyncSort for z/OS, Visual SyncSort, SYNCINIT, SYNCLIST and SYNCTOOL

Incrementing a sequence number in Header for each Job Run

Postby shiitiizz » Thu Dec 06, 2012 2:42 pm

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
shiitiizz
 
Posts: 16
Joined: Thu Dec 06, 2012 2:30 pm
Has thanked: 3 times
Been thanked: 0 time

Re: Incrementing a sequence number in Header for each Job Ru

Postby BillyBoyo » Thu Dec 06, 2012 3:33 pm

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.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: Incrementing a sequence number in Header for each Job Ru

Postby shiitiizz » Thu Dec 06, 2012 4:22 pm

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.
shiitiizz
 
Posts: 16
Joined: Thu Dec 06, 2012 2:30 pm
Has thanked: 3 times
Been thanked: 0 time

Re: Incrementing a sequence number in Header for each Job Ru

Postby BillyBoyo » Thu Dec 06, 2012 5:42 pm

BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: Incrementing a sequence number in Header for each Job Ru

Postby shiitiizz » Thu Dec 06, 2012 6:29 pm

Thanks Billy for your time and help!
shiitiizz
 
Posts: 16
Joined: Thu Dec 06, 2012 2:30 pm
Has thanked: 3 times
Been thanked: 0 time

Re: Incrementing a sequence number in Header for each Job Ru

Postby shiitiizz » Wed Dec 12, 2012 3:52 pm

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.
shiitiizz
 
Posts: 16
Joined: Thu Dec 06, 2012 2:30 pm
Has thanked: 3 times
Been thanked: 0 time

Re: Incrementing a sequence number in Header for each Job Ru

Postby BillyBoyo » Wed Dec 12, 2012 5:47 pm

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).
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: Incrementing a sequence number in Header for each Job Ru

Postby shiitiizz » Wed Dec 12, 2012 6:02 pm

I just edited my job to have a File name declared, as File3 ( RECFM = FB, LRECL = 80 )
//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
shiitiizz
 
Posts: 16
Joined: Thu Dec 06, 2012 2:30 pm
Has thanked: 3 times
Been thanked: 0 time

Re: Incrementing a sequence number in Header for each Job Ru

Postby shiitiizz » Wed Dec 12, 2012 6:14 pm

Hi, Kindly ignore the prev message..I got the desired result.
Thanks for your help and time
shiitiizz
 
Posts: 16
Joined: Thu Dec 06, 2012 2:30 pm
Has thanked: 3 times
Been thanked: 0 time

Re: Incrementing a sequence number in Header for each Job Ru

Postby BillyBoyo » Wed Dec 12, 2012 6:31 pm

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.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Next

Return to Syncsort/Synctool

 


  • Related topics
    Replies
    Views
    Last post