View previous topic :: View next topic
|
Author |
Message |
rmd3003
New User
Joined: 03 Jul 2006 Posts: 55
|
|
|
|
I need to update all records on file1 using single record on file2. No matching is needed - just sequential read all records on file1 and update every record with info from file2.
FILE1
Code: |
----+----1----+
0000000000AAAAA
0000000000BBBBB
0000000000CCCCC
0000000000DDDDD |
FILE2
Code: |
----+----1----+-
XXXXX |
OUTPUT
Code: |
----+----1----+
0000000000XXXXX
0000000000XXXXX
0000000000XXXXX
0000000000XXXXX |
|
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
rmd3003,
If you can pass the file2 data via a SYMNAMES dataset of FB,LRECL=80, you can try this.
Code: |
//STEP1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN= Input file
//SORTOUT DD DSN= Output file
//SYMNAMES DD *
DATA1,'XXXXX'
//SYSIN DD *
INREC OVERLAY=(11:DATA1)
SORT FIELDS=COPY
|
|
|
Back to top |
|
|
rmd3003
New User
Joined: 03 Jul 2006 Posts: 55
|
|
|
|
No, I'd rather use regular sort. I have an idea - use ICETOOL but still can't make it to work. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
The posted solution IS the regular sort. . .
Quote: |
No, I'd rather use regular sort. |
Why?
Why would using ICETOOL be "better" |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
actually, Arun needs to modify his post, and create a first step which creates the symname for the second step.
that would automate the process. |
|
Back to top |
|
|
sqlcode1
Active Member
Joined: 08 Apr 2010 Posts: 577 Location: USA
|
|
|
|
rmd3003,
What is the LRECL and RECFM of both input files and the expected output?
Thanks, |
|
Back to top |
|
|
rmd3003
New User
Joined: 03 Jul 2006 Posts: 55
|
|
|
|
sqlcode1 wrote: |
rmd3003,
What is the LRECL and RECFM of both input files and the expected output?
Thanks, |
Samples I posted here are just to show what I'm trying to do. Let's say file1 is 100 bytes and file2 is 80 bytes. File2 will always have one record but what's in pos 1:5 will change from run to run. File1 will have multiple records. |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
what positions in file1 are to be overlayed with the data in 1 thru 5 of file2. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
To repeat:
Quote: |
Hello,
The posted solution IS the regular sort. . .
Quote: |
No, I'd rather use regular sort.
Why?
Why would using ICETOOL be "better" |
|
d |
|
Back to top |
|
|
rmd3003
New User
Joined: 03 Jul 2006 Posts: 55
|
|
|
|
dbzTHEdinosauer wrote: |
what positions in file1 are to be overlayed with the data in 1 thru 5 of file2. |
11:15 |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
in this post, by frank yeager:
ibmmainframes.com/viewtopic.php?p=191294&highlight=sysnames#191294
he creates a sysnames dataset from the input.
in your case you only need to build 1 record that looks like the instream data of ARUN post.
the record you would build would be:
DATA1,'XXXXX'
where DATA1 would be a constant and the XXXXX would be the value in position 1-5 of your file2, which would be the input to this first step.
as frank's example shows, generate a temporary dataset as SORTOUT
and again reference this dataset as the
//SYMNAMES DD DSN=&&S1,DISP=(OLD,PASS)
for the second sort step, which would be ARUN's example.
so for your first sort step,
you only need to develop the sort cards to build the
DATA1,' in positions 1 thru 7
in positions 8 thru 12 extract positions 1 thru 5 of file2 (SORTIN of 1st sort step)
' in position 13. |
|
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. (I have no idea what you mean by "use regular sort".)
Code: |
//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=... input file2 (FB/80)
//SORTOUT DD DSN=&&S1,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)
//SYSIN DD *
OPTION COPY
INREC BUILD=(C'TARG,''',1,5,C'''',80:X)
/*
//S2 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SYMNAMES DD DSN=&&S1,DISP=(OLD,PASS)
//SORTIN DD DSN=... input file1 (FB/100)
//SORTOUT DD DSN=... output file (FB/100)
//SYSIN DD *
OPTION COPY
INREC OVERLAY=(11:TARG)
/*
|
|
|
Back to top |
|
|
Akatsukami
Global Moderator
Joined: 03 Oct 2009 Posts: 1788 Location: Bloomington, IL
|
|
|
|
Frank Yaeger wrote: |
(I have no idea what you mean by "use regular sort".) |
Probably either American or Swiss
(I have a friend who used to work in a delicatessen. He was once asked for a cheese sandwich. When he asked the customer what kind of cheese he wanted, he was told, "the regular sort".) |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Cute.
Quote: |
Dinosaurs dominated the Earth's ecosystem for one hundred million years. During this time, the largest mammal was the size of, and looked very much like, a rat. |
Rats rule!!!
Frank, who is owned by pet rats Nora, Sara, Wendy and Alice. |
|
Back to top |
|
|
|