i have the above file with customer number and then an invoice number.
i will need to take a 'new' customer number and place it into the middle of the 2 fields.
where i get that new number from only occurs once in another file. like this:
the number on the right has to go into every record that has the number on the left. got 3 people looking into as how we can do this and we are stuck. we believe we tried every splice combo in the book. Thanks in advance
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
It would have been nice if you'd spent more time to describe your requirement accurately. The positions and LRECL you indicate conflict.
The example you show is not very good and the output shown does not match the input.
Quote:
we dont have joinkeys as we are only at level 'G' not 'H'
JOINKEYS only requires level 'G', not level 'H' so I'll assume you can use it.
Here's a DFSORT job that will do what I think you want. I assumed your input fields were each 10 bytes so they start at 1 and 11 in the input file and should start at 1, 11 and 21 in the output file. I also assumed the records in each input file were already in order by the first field.
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
I still think JOINKEYS would be a better choice. If you would actually take the time to explain exactly what you're trying to do, I could show you how to use JOINKEYS to do it (or SPLICE if you really can't use JOINKEYS).
Your job is confusing and not well coded. Why do you have CTL5CNTL when you aren't USING it? Why are you copying from OUT2 to OUT4? I suspect you don't really need to use SORT with the COPY operators since SPLICE will do the sort anyway. What is in 103,10?
Joined: 10 Dec 2010 Posts: 96 Location: Massachusetts
Frank,
CTL5 was left in from an earlier try. My apologizies. And, yes, I do have joinkeys. Am not sure why it isn't in the manual i have for this tool but i tried it and it does connect.
in the XREFIN file are 2 cust nums. OLD cust num (1,10) and NEW cust num (11,10). in the SLSIN file are OLD custnums (9,10) and the invoice num (103,10). I have to match the from the SLSIN cust num to the XREFIN cust num to get the NEW cust num and report as:
old custnum, new custnum, invoice num
Code:
AA2830 AA2834 RAA2830004
for each record on the SLSIN file. We are doing a 3rd mock conversion as we speak so i will use what I have for now to keep rockin' , but, I will readdress the JOINKEY when time allows. It looks pretty slick. Ty again.
Joined: 10 Dec 2010 Posts: 96 Location: Massachusetts
Frank,
didnt answer the COPY question. I do that so I have the output to look at when it is in the SDSF queue. I don't have to go out and create a cataloged file and use browse to look at it. The output is readily available when I go to check the job.
Joined: 10 Dec 2010 Posts: 96 Location: Massachusetts
Code:
* MATCHES FROM PREVIOUS STEP
JOINKEYS FILE=F1,FIELDS=(001,010,A),SORTED
* CUSTOMER NUMBERS FROM THE TEXT FILE
JOINKEYS FILE=F2,FIELDS=(001,010,A),SORTED
JOIN UNPAIRED,F1,F2
* REPORT FIELDS, F1 NEW SAP CUSTNUM, F2 OLD CUSTNUM
REFORMAT FIELDS=(F1:01,10,F2:01,10,?)
* CONTROL STATEMENTS FOR MAIN TASK (JOINED RECORDS)
OPTION COPY
* NEW SAP CUSTNUM
OUTFIL FNAMES=F1ONLY,INCLUDE=(21,1,CH,EQ,C'1'),
BUILD=(01,10)
* OLD CUSTNUM
OUTFIL FNAMES=F2ONLY,INCLUDE=(21,1,CH,EQ,C'2'),
BUILD=(011,10)
* NEW SAP CUSTNUM THEN OLD CUSTNUM
OUTFIL FNAMES=(BOTH,BOTHJKE6),INCLUDE=(21,1,CH,EQ,C'B'),
BUILD=(01,10,011,10)
Frank was right. I had to do the JOINKEY process twice to mash everything down to its lowest common denominator but the above code will handle this situation every time i need it i believe. I had to tinker with it some to understand it functionality. Thanks again.