siddharth Beginner
Joined: 25 Jul 2003 Posts: 15 Topics: 7
|
Posted: Wed Nov 19, 2003 11:25 am Post subject: SYNCSORT - File Processing |
|
|
Hello All,
I have a sequential file with 500 variable length records in it.
The layout of the file is as follows:
Field Name Starting Position Length
------------------------------------------------------
OS-FILLER1 01 06
OS-DB-IDENT 07 08
OS-FILLER2 15 21
OS-USERID-IN 36 08
OS-FILLER3 44 03
OS-SSN-IN 47 09
-------------------------------------------------------
Problem statement:
I need to replace the OS-SSN-IN field in every record with OS-USERID-IN for all the records.
Expected result:
Output file with the record structure same as the input file. Only difference would be that for every record the OS-SSN-IN would be replaced by OS-USERID-IN field of that record.
Can I do this using SORT??? If Not, please provide with the sample easytrieve code to achieve the above results.
Needs immediate attention.
Thank You.
Siddharth. |
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12369 Topics: 75 Location: San Jose
|
Posted: Wed Nov 19, 2003 11:46 am Post subject: |
|
|
Siddharth,
The following JCl will give you the desired results.Since your input file is a VB file , you need to add 4 bytes to the start positions of each field to accomodate the RDW.
Code: |
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=YOUR INPUT VB FILE,
// DISP=SHR
//SORTOUT DD DSN=YOUR OUTPUT FILE,
// DISP=(NEW,CATLG,DELETE),
// UNIT=SYSDA,
// SPACE=(CYL,(X,Y),RLSE)
//SYSIN DD *
SORT FIELDS=COPY
OUTFIL OUTREC=(1,4, $ RDW
5,46, $ ALL FIELDS BEFORE SSN-IN
51:40,8, $ REPLACE SSN-IN WITH USER-ID
X, $ SPACE SINCE USER-ID IS ONLY 8 BYTES
60) $ REST OF THE RECORD STARTING FROM 60.
//*
|
Hope this helps...
cheers
kolusu |
|