Page 1 of 1

Add sequence number to records

PostPosted: Mon Jun 15, 2015 6:28 pm
by Prasanna G
Hi

I have a variable length file of LRECL 27994. The file contains records as follows.

SCUSTOMR...................-..41994021
SCUSTOFL.................../...0000000
SCUSLOCN...................Âç..1994021
SCUSTOMR...................øÌ..201402
SCUSTOFL...................É:..200803
SCUSTOMR...................µ. 200004
SCUSTOFL...................~...000000
SCUSLOCN...................sç 199907
SCUSTAMO...................t. 201403
SCUSTOMR...................µ. 200005
SCUSTOMR...................µ. 200007


Whenever a record starts with SCUSTOMR a new number should be prefixed and the same should be carry forwarded to rest of the records until another record with SCUSTOMR is encountered.

0001SCUSTOMR...................-..4199402
0001SCUSTOFL.................../...0000000
0001SCUSLOCN...................Âç..199402
0002SCUSTOMR...................øÌ..201402
0002SCUSTOFL...................É:..200803
0003SCUSTOMR...................µ. 200004
0003SCUSTOFL...................~...000000
0003SCUSLOCN...................sç 199907
0003SCUSTAMO...................t. 201403
0004SCUSTOMR...................µ. 200005
0005SCUSTOMR...................µ. 200007
.

Kindly help me to achieve the above using SYNCSORT FOR Z/OS 2.1.0.0R.

Thanks
Prasanna G.

Re: Add sequence number to records

PostPosted: Mon Jun 15, 2015 6:33 pm
by BillyBoyo
You need to first arrange the space to extend the record, in INREC with WHEN=INIT and BUILD something like (1,4,4X,5).

Then you continue with IFTHEN=(WHEN=GROUP with BEGIN for your significant value, and PUSH=(5:ID=4).