|
View previous topic :: View next topic
|
| Author |
Message |
mohitsaini Warnings : 1 New User
Joined: 15 May 2006 Posts: 92
|
|
|
|
Hi there,
My requirement is as follows:
File 1 (FB/100): Contains only 1 rec and has the below data.
11015
File 2 (FB/1000): Contains only 1 rec and has the below data.
From this file I need to copy data from byte number 20 to 1000 (ALL data is in Packed decimal).
Output file (FB/2000): Will Contain only 1 rec and should be having the below data.
The output needs to look like this
OUT11015XXXXXXXXXXX
OUT --> hardcoded (We need to move OUT in this output file)
11015 --> from File 1
XXXXXXXXXXX --> From File 2 (data from byte number from 20th to 1000th)
The above is a simplified version of what I actually require. In the real scenario I am dealing with different LRECLs and different data.
My attempt is as follows:
I tried using FILEAID utility (via JCL) and successfully achieved only two parts of the requirement. That is I got my output as:
OUT11015
For OUT I used --> MOVE=(1,C'OUT')
For 11015 -->I again used MOVE statement to copy the data from FILE 1
But I couldn't manage to write data from FILE 2. I tried many things in FILEAID but didn't get any success.
Could you please advise on this. I am open to use other utilities too. |
|
| Back to top |
|
 |
gcicchet
Senior Member
Joined: 28 Jul 2006 Posts: 1702 Location: Australia
|
|
|
|
Hi,
you can use this
| Code: |
//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=input file1
11015
/*
//SORTOUT DD DSN=&&S1,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)
//SYSIN DD *
OPTION COPY
INREC BUILD=(C'FILE1VAL,''',1,5,C'''',80:X)
/*
//S2 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SYMNAMES DD DSN=&&S1,DISP=(OLD,PASS)
//SYMNOUT DD SYSOUT=*
//SORTIN DD DSN=input file2
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
OUTREC BUILD=(C'OUT',FILE1VAL,20,981,2000:X)
/*
|
Gerry |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Developer

Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Here's another way to do this with DFSORT:
| Code: |
//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//IN1 DD DSN=... input file1 (FB/100)
//IN2 DD DSN=... input file2 (FB/1000)
//SORTOUT DD DSN=... output file (FB/2000)
//SYSIN DD *
JOINKEYS F1=IN1,FIELDS=(6,1,A),SORTED,NOSEQCK
JOINKEYS F2=IN2,FIELDS=(6,1,A),SORTED,NOSEQCK
REFORMAT FIELDS=(F1:1,5,F2:20,981)
OPTION COPY
OUTREC BUILD=(C'OUT',1,5,6,981,2000:X)
/*
//JNF2CNTL DD *
INREC OVERLAY=(6:X)
/*
|
|
|
| Back to top |
|
 |
mohitsaini Warnings : 1 New User
Joined: 15 May 2006 Posts: 92
|
|
|
|
Thanks Frank. Sorry for the late reply. Unfortunately, my system isn't updated with latest SORT and therefore I cannot use Joinkeys. I am trying to get it working thru spice/icetool step.
I have got one more requirement which is as follows:
File 1 (FB/80): (Contains only 1 record)
XXXXXXX11029XXXXXXXX11030XXXXXXXX11031
File 2 (FB/80): (Contains only 1 record)
FFQ#####00100999999999999999999999999999
Now I want to replace "#####" in FILE 2 with 11029 (from FILE 1).
Again I tried it using FILEAID and I am able to copy the required data but everything else is replaced by spaces.
Any kind of help will be really appreciated. |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Developer

Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
If ##### is always at position 4 in File2, you can use a DFSORT job like the following:
| Code: |
//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
XXXXXXX11029XXXXXXXX11030XXXXXXXX11031
//SORTOUT DD DSN=&&S1,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)
//SYSIN DD *
OPTION COPY
INREC BUILD=(C'REPFLD,''',8,5,C'''',80:X)
//S2 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SYMNAMES DD DSN=&&S1,DISP=(OLD,PASS)
//SORTIN DD *
FFQ#####00100999999999999999999999999999
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
INREC OVERLAY=(4:REPFLD)
|
If ##### can be anywhere in File2, you can replace the INREC statement above with this one:
| Code: |
INREC FINDREP=(IN=C'#####',OUT=REPFLD)
|
|
|
| Back to top |
|
 |
mohitsaini Warnings : 1 New User
Joined: 15 May 2006 Posts: 92
|
|
|
|
Thanks frank ... I tried this out on the data that I initially provided and it is working fine.
However, when I tried the same thing on different data (Comp-3) I was getting a duplicate error (with MAXCC=16) on
| Code: |
| INREC OVERLAY=(4:REPFLD) |
Right now I don't have access to mainframes therefore I won't be able to write much on what exactly the error I am getting. |
|
| Back to top |
|
 |
mohitsaini Warnings : 1 New User
Joined: 15 May 2006 Posts: 92
|
|
|
|
Hey Frank,
I have got rid of the duplicate problem by using STOPAFT and SKIPREC parameters.
Actually I have many recs in the input file and only one record in my ouput file. That's why I was getting that duplicate error. |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|