View previous topic :: View next topic
|
Author |
Message |
murmohk1
Senior Member
Joined: 29 Jun 2006 Posts: 1436 Location: Bangalore,India
|
|
|
|
Hi,
I have two flat files as below -
file1 (lrecl=6 bytes):
77 constant pic 9(6)
file2 details (lrecl=601 bytes):
Layout-
01 group
03 some_data (595 bytes in lenght)
03 numvar pic 9(6)
File1 always has ONE record. Whereas number of records in File2 varies from run to run.
My requirement is to add the file1 value to NUMVAR of file2. For ex -
file1-
000145
file2-
------------------------
somedata numvar
-------------------------
1record 000001
2record 000005
3record 000018
The resultant file should be -
1record 000146 ----> where 000146 = 000001+000145
2record 000150
3record 000163
At present we are using COBOL program for this purpose. As SORT is more efficient over COBOL, we decided to switch over. Please help me in resolving this.
Regards,
Mohan |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Here's a DFSORT job that will do what you asked for:
Code: |
//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=... input file1 (FB/6)
//SORTOUT DD DSN=&&S1,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)
//SYSIN DD *
OPTION COPY
* Create DFSORT Symbol as follows with nnnnnn from file1
* Con1,+nnnnnn
INREC BUILD=(C'Con1,+',1,6,80:X)
/*
//S2 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SYMNAMES DD DSN=&&S1,DISP=(OLD,PASS)
//SORTIN DD DSN=... input file2 (FB/601)
//SORTOUT DD DSN=... output file (FB/601)
//SYSIN DD *
OPTION COPY
* Add Con1 to numvar in each file2 record.
INREC OVERLAY=(596:596,6,ZD,ADD,Con1,TO=ZD,LENGTH=6)
/*
|
|
|
Back to top |
|
|
murmohk1
Senior Member
Joined: 29 Jun 2006 Posts: 1436 Location: Bangalore,India
|
|
|
|
Thanks Franks for the resolution. |
|
Back to top |
|
|
murmohk1
Senior Member
Joined: 29 Jun 2006 Posts: 1436 Location: Bangalore,India
|
|
|
|
Very sorry Frank about the name in my earlier post. |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Quote: |
Very sorry Frank about the name in my earlier post. |
No problem. I've been called lots worse than "Franks". |
|
Back to top |
|
|
IQofaGerbil
Active User
Joined: 05 May 2006 Posts: 183 Location: Scotland
|
|
|
|
...tell us , are they printable? |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Some of them. |
|
Back to top |
|
|
|