Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Insert values from one file to another file.

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

New User


Joined: 16 Oct 2006
Posts: 80
Location: chennai

PostPosted: Fri Aug 10, 2012 5:16 pm    Post subject: Insert values from one file to another file.
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.

http://ibmmainframes.com/about53227.html

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

Pandora-Box

Moderator


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

PostPosted: Fri Aug 10, 2012 6:57 pm    Post subject:
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

Site Director


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

PostPosted: Fri Aug 10, 2012 6:57 pm    Post subject:
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    Post subject:
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    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 SORTJOIN - Copy Matched and Unmatched... Steve Ironmonger DFSORT/ICETOOL 5 Tue Jan 17, 2017 4:26 pm
No new posts Copy RECFM =VB TO FB file with RECL =... sahil41352 DFSORT/ICETOOL 3 Wed Dec 28, 2016 11:29 pm
No new posts SQL query to run through list of valu... Ni3-db2 DB2 14 Wed Dec 14, 2016 9:52 am
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us