Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Merge 1 field onto another record

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
madmartinsonxx

New User


Joined: 10 Dec 2010
Posts: 96
Location: Massachusetts

PostPosted: Fri Feb 04, 2011 11:41 pm    Post subject: Merge 1 field onto another record
Reply with quote

Code:

AA2830                        RAA2830004
AA2830                        RAA2830005
AA2830                        RAA2830009
AA2830                        RAA2830013
AA2832                        RAA2832001
AA2834                        RAA2834001
AA2834                        RAA2834002

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:

Code:

AA2830     AA2834
AA2832     AA2834
AA2834     AA2834
AA2847     AA2847
AA2853     AA2853
AA2854     AA2854
AA2855     AA2855

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
Back to top
View user's profile Send private message

Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Sat Feb 05, 2011 12:04 am    Post subject:
Reply with quote

It's not clear from your description what you want to do exactly.

Please show the expected output for your input example.

Give the RECFM and LRECL of the input files.

Give the starting position, length and format of each relevant field.

I suspect JOINKEYS would be a better choice for this then SPLICE.
Back to top
View user's profile Send private message
madmartinsonxx

New User


Joined: 10 Dec 2010
Posts: 96
Location: Massachusetts

PostPosted: Sat Feb 05, 2011 12:13 am    Post subject: merging 1 field onto another record
Reply with quote

lrecl of both files is 20
recfm is fb
records should look like following on output:
Code:

AA2830     AA2834          RAA2830004
AA2830     AA2834          RAA2830004
AA2830     AA2834          RAA2830004
AA2830     AA2834          RAA2830004
AA2832     AA2834          RAA2832001


1st field is 10 bytes. 2nd field from 2nd file i need to merge is 10 bytes.
the 3rd field, invoice number is 10 bytes on the 2nd file in pos 12.

we dont have joinkeys as we are only at level 'G' not 'H'.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Sat Feb 05, 2011 12:55 am    Post subject:
Reply with quote

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.

Code:

//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//IN1 DD DSN=...  input file1 (FB/20)
//IN2 DD DSN=...  input file2 (FB/20)
//SORTOUT DD DSN=...  output file (FB/30)
//SYSIN DD *
  JOINKEYS F1=IN1,FIELDS=(1,10,A),SORTED
  JOINKEYS F2=IN2,FIELDS=(1,10,A),SORTED
  REFORMAT FIELDS=(F1:1,10,F2:11,10,F1:11,10)
  OPTION COPY
/*


For your input example, SORTOUT would have:

Code:

AA2830    AA2834    RAA2830004       
AA2830    AA2834    RAA2830005       
AA2830    AA2834    RAA2830009       
AA2830    AA2834    RAA2830013       
AA2832    AA2834    RAA2832001       
AA2834    AA2834    RAA2834001       
AA2834    AA2834    RAA2834002       


If that's not what you want, then you need to do a better job of explaining what you do want.
Back to top
View user's profile Send private message
madmartinsonxx

New User


Joined: 10 Dec 2010
Posts: 96
Location: Massachusetts

PostPosted: Sat Feb 05, 2011 1:00 am    Post subject: merging 1 field onto another record multiple times
Reply with quote

Code:

  COPY FROM(XREFIN) TO(OUT2) USING(CTL4)                                 
  COPY FROM(SLSIN)  TO(OUT2) USING(CTL2)                                 
  SPLICE FROM(OUT2) TO(OUT3) -                                           
         ON(001,010,CH) -                                               
         WITH(030,011) WITHALL                                           
  COPY FROM(OUT2) TO(OUT4)                                               
 //*                                                                     
 //CTL5CNTL  DD *                                                       
  OUTFIL BUILD=(001,010,012,010,030,010)                                 
 //CTL2CNTL  DD *                                                       
  SORT FIELDS=(009,10,CH,A)                                             
  INCLUDE COND=(009,4,CH,NE,C'NONE',AND,009,007,CH,NE,C'GENERIC',AND,   *
                009,008,CH,NE,C'MULTIPLE')                               
  OUTREC FIELDS=(009,10,20X,103,10)                                     
 /*                                                                     
 //CTL4CNTL  DD *                                                       
  SORT FIELDS=(001,10,CH,A)                                             
  OUTREC FIELDS=(001,010,1X,011,010,20X)                                 
 /*                                                                     


ty very much frank. i will outline things more clearly. i got it to work 'finally' with the above after trying all morning. we are jumping for joy.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Sat Feb 05, 2011 1:19 am    Post subject:
Reply with quote

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?
Back to top
View user's profile Send private message
madmartinsonxx

New User


Joined: 10 Dec 2010
Posts: 96
Location: Massachusetts

PostPosted: Sat Feb 05, 2011 1:47 am    Post subject: merge 1 field from a record to another record
Reply with quote

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.
Back to top
View user's profile Send private message
madmartinsonxx

New User


Joined: 10 Dec 2010
Posts: 96
Location: Massachusetts

PostPosted: Sat Feb 05, 2011 1:54 am    Post subject: merge 1 field into another record
Reply with quote

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.
Back to top
View user's profile Send private message
madmartinsonxx

New User


Joined: 10 Dec 2010
Posts: 96
Location: Massachusetts

PostPosted: Sat Feb 12, 2011 3:22 am    Post subject: Merge 1 field onto another record
Reply with quote

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.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts query to fetch record which has only ... maxsubrat DB2 12 Mon Dec 11, 2017 5:03 pm
No new posts Extract record for change in combinat... Trinadh DFSORT/ICETOOL 6 Thu Nov 23, 2017 3:32 pm
No new posts Extract Record using range of Data scorp_rahul23 DFSORT/ICETOOL 3 Wed Nov 15, 2017 11:54 pm
No new posts Squeeze record left so that zeroes ar... Vignesh Sid SYNCSORT 5 Fri Nov 10, 2017 1:40 pm
No new posts Formatting multiple records to a sing... Vignesh Sid SYNCSORT 3 Tue Nov 07, 2017 12:22 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us