IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Insert values from one file to another file.


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
rguhanath

New User


Joined: 16 Oct 2006
Posts: 81
Location: chennai

PostPosted: Fri Aug 10, 2012 5:16 pm
Reply with quote

Hi,
I would like to extract and include data from one file record to another file record in multiple positions based on condition. Please find below for the problem details.

input file 1
------------
LENGTH(200),RECFM=FB

Code:

(1,7),SPACE,(9,4),SPACE,(14-4),SPACE,(19,4),SPACE,(24,4),SPACE,(29,4),168SPACE,
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0
RECORD1 0001 0005 0002 0003 0002
RECORD2 0005 0001 0003 0002 0005
RECORD3 0003 0001 0002 0001
RECORD4 0002 0005 0004 0003 0001
RECORD5 0001 0003 0002 0001
RECORD6 0003 0001 0002 0001 0005


input file 2
--------------
LENGTH(80),RECFM=FB

Code:

(1,4),SPACE,(6,10),66SPACE
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
0005 AAAAAAAAAA
0001 CCCCCCCCCC
0003 HHHHHHHHHH
0004 DDDDDDDDDD

0007 YYYYYYYYYY
0002 BBBBBBBBBB
0010 RRRRRRRRRR
0006 UUUUUUUUUU


Expected output file:
---------------------
LENGTH=100,RECFM=FB
Code:

----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0
RECORD1 0001 CCCCCCCCCC 0005 AAAAAAAAAA 0002 BBBBBBBBBB 0003 HHHHHHHHHH 0002 BBBBBBBBBB
RECORD2 0005 AAAAAAAAAA 0001 CCCCCCCCCC 0003 HHHHHHHHHH 0002 BBBBBBBBBB 0005 AAAAAAAAAA
RECORD3 0003 HHHHHHHHHH 0001 CCCCCCCCCC 0002 BBBBBBBBBB 0001 CCCCCCCCCC
RECORD4 0002 BBBBBBBBBB 0005 AAAAAAAAAA 0004 DDDDDDDDDD 0003 HHHHHHHHHH 0001 CCCCCCCCCC
RECORD5 0001 CCCCCCCCCC 0003 HHHHHHHHHH 0002 BBBBBBBBBB 0001 CCCCCCCCCC
RECORD6 0003 HHHHHHHHHH 0001 CCCCCCCCCC 0002 BBBBBBBBBB 0001 CCCCCCCCCC 0005 AAAAAAAAAA


I walk thru the below mentioned link which is similar to my requirement and it was not worked after I did some changes in the code. Please help me on this. Thanks in Advance.

ibmmainframes.com/about53227.html

-Nath.
Back to top
View user's profile Send private message
Pandora-Box

Global Moderator


Joined: 07 Sep 2006
Posts: 1592
Location: Andromeda Galaxy

PostPosted: Fri Aug 10, 2012 6:57 pm
Reply with quote

Nath,

Being in forum for 6 years you never helped yourself?

You never told us what was the problem you got?

Show us the job , control cards, sysout or error messages you got?
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Fri Aug 10, 2012 6:57 pm
Reply with quote

Hello,

What did you change? What happened?

You need to post the jcl and sort control statements used as well as the informational output generated by your run.
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Fri Aug 10, 2012 10:44 pm
Reply with quote

rguhanath,

Use the following DFSORT JCL which will give you the desired results

Code:

//STEP0100 EXEC PGM=SORT                                   
//SYSOUT   DD SYSOUT=*                                     
//SORTIN   DD DISP=SHR,DSN=Your Input 200 byte file1
//SORTOUT  DD DSN=&&TMP,DISP=(,PASS),SPACE=(CYL,(X,Y),RLSE)
  SORT FIELDS=COPY                                         
  INREC OVERLAY=(40:SEQNUM,8,ZD)                           
  OUTFIL BUILD=(40,8,C'1',1,7,08,5,/,                       
                40,8,C'2',1,7,13,5,/,                       
                40,8,C'3',1,7,18,5,/,                       
                40,8,C'4',1,7,23,5,/,                       
                40,8,C'5',1,7,28,5)                         
//*                                       
//STEP0200 EXEC PGM=SORT                                   
//SYSOUT   DD SYSOUT=*                                     
//INA      DD DSN=&&TMP,DISP=SHR                           
//INB      DD DISP=SHR,DSN=Your Input 80 byte file2
//SORTOUT  DD SYSOUT=*                                     
//SYSIN    DD *                                           
  JOINKEYS F1=INA,FIELDS=(18,4,A)                         
  JOINKEYS F2=INB,FIELDS=(01,4,A)                         
  JOIN UNPAIRED,F1                                         
  REFORMAT FIELDS=(F1:1,21,F2:5,11)                       
  SORT FIELDS=(1,9,CH,A)                                   
                                                           
  OUTREC IFOUTLEN=108,IFTHEN=(WHEN=INIT,BUILD=(101:1,32)),
  IFTHEN=(WHEN=GROUP,BEGIN=(109,1,ZD,EQ,1),               
  PUSH=(01:110,8,118,4,122,11),RECORDS=5),                 
  IFTHEN=(WHEN=GROUP,BEGIN=(109,1,ZD,EQ,2),               
  PUSH=(24:117,5,122,11),RECORDS=4),                       
  IFTHEN=(WHEN=GROUP,BEGIN=(109,1,ZD,EQ,3),               
  PUSH=(40:117,5,122,11),RECORDS=3),                       
  IFTHEN=(WHEN=GROUP,BEGIN=(109,1,ZD,EQ,4),               
  PUSH=(56:117,5,122,11),RECORDS=2),                       
  IFTHEN=(WHEN=(109,1,ZD,EQ,1),OVERLAY=(24:77X)),         
  IFTHEN=(WHEN=(109,1,ZD,EQ,2),OVERLAY=(40:60X)),         
  IFTHEN=(WHEN=(109,1,ZD,EQ,3),OVERLAY=(56:44X)),         
  IFTHEN=(WHEN=(109,1,ZD,EQ,4),OVERLAY=(72:28X)),         
  IFTHEN=(WHEN=(109,1,ZD,EQ,5),OVERLAY=(72:117,5,122,11)) 
                                                           
  OUTFIL REMOVECC,NODETAIL,BUILD=(100X),                   
  SECTIONS=(101,8,TRAILER3=(1,100))                       
//*
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Access to non cataloged VSAM file JCL & VSAM 18
Search our Forums:

Back to Top