-1

My question is i want to append one value from one dataset to another dataset.

Below is the screenshot of the first dataset. enter image description here

Below is the screenshot of the second dataset.

enter image description here

I want the 0 value which is present at the 50th position the needs to added in the second file at 50th position, so how i can do it using JCL using a sort step.

This needs to be done using a step in JCL , please help me out.

Vivin K
  • 2,681
  • 1
  • 11
  • 14
shruthi
  • 29
  • 4
  • This is the same question as the one that you posted yesterday - almost. Concatenate the two datasets (you are on a mainframe where a file is not the same as a dataset) and you have exactly the same question. And please do not post the same question on multiple forums - I have deleted it in other places. Also, What are all these tags for - if anything it is probably a DFSORT question but it is not a JCL question as JCL does not manipulate data and as for the others.... – NicC Apr 09 '20 at 09:24
  • I tried with IEBGENER it justs added in the first line but my question is 0 must be added in the second dataset in the existing line itself, the solution which you said concatenate it just add two data into one, but i want the first dataset data to be added in the second dataset in the existing line itself – shruthi Apr 09 '20 at 10:36
  • I said that if you concatenate the datasets then the solution is the same as if the data was as you posted in your other question. You concatenate them to your SORTIN DD statement. – NicC Apr 09 '20 at 14:36

1 Answers1

0

I would suggest you to insert sequence numbers at the end (position 81) in both the datasets and do a RIGHT JOIN in DFSORT with sequence number as key. Here is a solution using ICETOOL which does all the tasks in one step.

//XXXXXXA JOB 1,NOTIFY=&SYSUID              
//STEP01  EXEC PGM=ICETOOL                  
//INA     DD DSN=XXXXXX.PS.A,DISP=SHR       
//INB     DD DSN=XXXXXX.PS.B,DISP=SHR       
//JNA DD DSN=&&JNA,DISP=(,DELETE),          
//       SPACE=(CYL,(1,0),RLSE),            
//       DCB=(LRECL=82,RECFM=FB,BLKSIZE=0)  
//JNB DD DSN=&&JNB,DISP=(,DELETE),          
//       SPACE=(CYL,(1,0),RLSE),            
//       DCB=(LRECL=82,RECFM=FB,BLKSIZE=0)  
//OUT     DD DSN=XXXXXX.PS,OUT3,
//        DISP=(,CATLG,DELETE), 
//        SPACE=(CYL,(1,0),RLSE),
//        DCB=(LRECL=80,RECFM=FB,BLKSIZE=0)                       
//TOOLMSG DD SYSOUT=*                       
//DFSMSG  DD SYSOUT=*                       
//SYSOUT  DD SYSOUT=*                       
//TOOLIN  DD *                              
  SORT FROM(INA) TO(JNA) USING(CTL1)        
  SORT FROM(INB) TO(JNB) USING(CTL1)        
  SORT JKFROM TO(OUT) USING(CTL2)           
/*                                          
//CTL1CNTL DD *                             
  SORT FIELDS=COPY                          
  OUTREC BUILD=(1,80,81:SEQNUM,2,ZD)        
//CTL2CNTL DD *                             
  JOINKEYS F1=JNA,FIELDS=(81,2,A)           
  JOINKEYS F2=JNB,FIELDS=(81,2,A)           
  REFORMAT FIELDS=(F2:1,49,F1:50,1,F2:51,30)
  JOIN UNPAIRED,F2                          
  SORT FIELDS=COPY                            

Contents in XXXXXX.PS.A dataset:

 ----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
 ***************************** Top of Data ******************************
                                                  7                      
 **************************** Bottom of Data **************************** 

Contents in XXXXXX.PS.B dataset:

 ----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
 ***************************** Top of Data ******************************
 PUT 'LCDT.ORDER.ORDRAD' LCD_BI_ORDERINFO_&OYMD._00 _01.txt              
 quit                                                                    
 /*                                                                      
 **************************** Bottom of Data ****************************

And, contents in the final output dataset, XXXXXX.PS.OUT3:

 ----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
 ***************************** Top of Data ******************************
 PUT 'LCDT.ORDER.ORDRAD' LCD_BI_ORDERINFO_&OYMD._07 _01.txt              
 quit                                                                    
 /*                                                                      
 **************************** Bottom of Data ****************************

Hope this helps.

Srinivasan JV
  • 705
  • 5
  • 12