|
|
| Author |
Message |
muffirulz
Active User
Joined: 14 Sep 2005 Posts: 50 Location: Kentucky, USA
|
|
|
|
Hi,
Please can anyone help me out with the following.
I have following File1 as
| Code: |
01 FILE1-VARS.
05 FILE1-TRANS-TYPE PIC X(01)
05 FILE1-SOURCE PIC X(01)
05 FILE1-BATCH PIC X(14)
05 FILE1-DCN PIC X(18)
05 FILE1-FILL PIC X(66)
|
and File2 as
| Code: |
01 FILE2-VARS.
05 FILE2-DCN PIC X(18)
05 FILE2-BATCH PIC X(14)
05 FILE2-SCAN-DATE PIC X(06)
05 FILE2-SCAN-TIME PIC X(06)
05 FILE2-RECV-DATE PIC X(06)
05 FILE2-RECV-TIME PIC X(06)
05 FILE2-OTH-ATTACH-IND PIC X(01)
05 FILE2-FORM-TYPE PIC X(03)
05 FILE2-SOURCE-GROUP-ID PIC X(07)
05 FILLER PIC X(33)
|
Using outrec I would like to move the variables from File1 to File2 as follows:
FILE1-DCN3 -----> FILE2-DCN
FILE1-BATCH3 -----> FILE2-BATCH
spaces -----> FILE2-SCAN-DATE
spaces -----> FILE2-SCAN-TIME
spaces -----> FILE2-RECV-DATE
spaces -----> FILE2-RECV-TIME
spaces -----> FILE2-OTH-ATTACH-IN
‘BAD‘ -----> FILE2-FORM-TYPE
‘N/A ‘ -----> FILE2-SOURCE-GROUP-ID
Thanks,
Muffazel |
|
| Back to top |
|
 |
References
|
|
 |
arcvns
Senior Member
Joined: 17 Oct 2006 Posts: 994 Location: Chennai, India
|
|
|
|
Muffazel,
Try this SORT card.
| Code: |
INREC BUILD=(17,18,3,14,25X,'BADN/A',37X)
OPTION COPY |
Thanks,
Arun |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Moderator
Joined: 15 Feb 2005 Posts: 4684 Location: San Jose, CA
|
|
|
|
Muffazel,
It's not clear what you want to do. You say you want to move the variables from file1 to file2. Do each of these files only have one record, or do they have more than one record. Do you want to move fields from record 1 of file1 to record 1 of file2, fields from record 2 of file1 to record 2 of file2, etc? Or do you want to move fields between the records of the two files in some other way? How?
| Quote: |
FILE1-DCN3 -----> FILE2-DCN
FILE1-BATCH3 -----> FILE2-BATCH
|
I see a FILE1-DCN field, but not a FILE1-DCN3 field. What is FILE1-DCN3?
I see a FILE1-BATCH field, but not a FILE1-BATCH3 field. What is FILE1-BATCH3?
Please show an example of the records in each input file and what you expect for output. Explain the "rules" for getting from input to output. Give the RECFM and LRECL of the input files.
Arun,
I don't know what you're doing with the INREC statement you show, but whatever it is, it only operates on file, not two files as requested. |
|
| Back to top |
|
 |
muffirulz
Active User
Joined: 14 Sep 2005 Posts: 50 Location: Kentucky, USA
|
|
|
|
Hi,
I am sorry it was a typo.
Following is the corrected version
Move FILE1-DCN -----> FILE2-DCN
Move FILE1-BATCH -----> FILE2-BATCH
Move spaces -----> FILE2-SCAN-DATE
Move spaces -----> FILE2-SCAN-TIME
Move spaces -----> FILE2-RECV-DATE
Move spaces -----> FILE2-RECV-TIME
Move spaces -----> FILE2-OTH-ATTACH-IN
Move ‘BAD‘ -----> FILE2-FORM-TYPE
Move ‘N/A ‘ -----> FILE2-SOURCE-GROUP-ID
Actually I have to move records from File1 to File2 and there can be more than one record in File1.
Both the files are FB.
LRECL
File1 - 200
File2 - 100
I hope I am clear.
Thanks,
Muffazel Madda |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Moderator
Joined: 15 Feb 2005 Posts: 4684 Location: San Jose, CA
|
|
|
|
| Quote: |
| I hope I am clear. |
No, you're not.
| Quote: |
| Actually I have to move records from File1 to File2 and there can be more than one record in File1. |
Again, how do you want to match up the records in file1 with the records in file2? One at a time (file1 record 1 with file2 record1, file1 record 2 with file2 record2? By a key in the two records (what key)? Some other way?
Please go back and read my first post and answer ALL of my questions, show the requested example of input and output records, and explain the "rules" for "move records from File1 to File2".
I'm willing to help, but I can't read your mind. |
|
| Back to top |
|
 |
arcvns
Senior Member
Joined: 17 Oct 2006 Posts: 994 Location: Chennai, India
|
|
|
|
Frank,
| Quote: |
Arun,
I don't know what you're doing with the INREC statement you show, but whatever it is, it only operates on file, not two files as requested. |
I m not sure if I have really misunderstood the OPs requirement. But from whatever he has posted, it seems like he just want to copy records from input to output ;but with a change in the layout.
| Quote: |
| Again, how do you want to match up the records in file1 with the records in file2? |
Muffazel said he just want to move records from file1 to file2. He has not mentioned anything about file-matching.
Muffazel,
Can you try this JCL. If this does not satisfy your requirement, you need to explain the rules in detail as Frank suggested.
| Code: |
//STEP1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=file1......> FB/LRECL=200
//SORTOUT DD DSN=file2......> FB/LRECL=100
//SYSIN DD *
INREC BUILD=(17,18,3,14,25X,C'BADN/A',100:X)
OPTION COPY |
Thanks,
Arun |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Moderator
Joined: 15 Feb 2005 Posts: 4684 Location: San Jose, CA
|
|
|
|
Arun,
So you're saying that File1 here is the input and File2 is the output?
I assumed that when the OP said I have File1 and File2, he meant that these files already existed so he wanted to combine them in some way. But perhaps you're right that he really meant he has File1 and wants to create File2 from it. Sometimes the words people use can be quite misleading.
Confusing things more, you showed him a solution based on that assumption earlier and he didn't come back and say "yes, that's what I need". |
|
| Back to top |
|
 |
|
|
|