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

Update a field in a file with that from another file


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

New User


Joined: 13 Mar 2006
Posts: 59
Location: UK

PostPosted: Mon Apr 30, 2007 4:23 pm
Reply with quote

Hi,

I want to update the field of a file (I know the field positions) with the values from another field in another file using JCL . I dont want to use a program.
I know how to update in a static manner..i.e using OUTREC and CHANGE but how to do it dynamically.

Please let me know .
Thanks ,
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: Mon Apr 30, 2007 7:52 pm
Reply with quote

Hello,

You need to post some sample input data and what you want for output from the sample input data. You also need to post whether the input is fixed or variable and the lrecl(s). You know the "field positions" but no one here does. . . They need to be posted as well.
Back to top
View user's profile Send private message
arnab

New User


Joined: 13 Mar 2006
Posts: 59
Location: UK

PostPosted: Mon Apr 30, 2007 8:08 pm
Reply with quote

hi,

The file is Fixed and of LRECL 80.
Sample data:

1st file:

1192873 CMS
1123849 EXP
1132456 EXP
1143240 HRS

2nd file:

1192873 ALB
1123849 EXP
1132456 FIL

Expected o/p:

1192873 ALB
1123849 EXP
1132456 FIL
1143240 HRS

The remaining data in the files are different and the o/p should contain data that of FILE1 and not of FILE2.

Let me know if this explains the problem and if you need something more.

Thanks..
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


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

PostPosted: Mon Apr 30, 2007 8:50 pm
Reply with quote

Your example leaves a lot of questions unanswered. It would help if you'd explain the "rules" for getting from input to output so we don't have to guess.

Do you want to update the fields based on the key in positions 1-7 (1192873 in file1 and 1192873 in file2) or based on the relative record number (record 1 in file1 and record1 in file2)?

Do you want the output records in the original order of the file1 records, or can the output records be in key order?

Can there be records in file2 that are not in file1? If so, what do you want to do with those records?
Back to top
View user's profile Send private message
arnab

New User


Joined: 13 Mar 2006
Posts: 59
Location: UK

PostPosted: Wed May 02, 2007 1:46 pm
Reply with quote

I want to update based on the key positions..and there can be records in the second file which are not in the first file. In that case we have to omiy those in the final o/p.
the order of the o/p ecords is of no concern to me.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


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

PostPosted: Wed May 02, 2007 8:29 pm
Reply with quote

Here's a DFSORT/ICETOOL job that will do what you asked for:

Code:

//S1    EXEC  PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG  DD SYSOUT=*
//IN1 DD DSN=...  input file1 (FB/80)
//IN2 DD DSN=...  input file2 (FB/80)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//OUT DD DSN=...  output file (FB/80)
//TOOLIN   DD    *
COPY FROM(IN2) TO(T1) USING(CTL1)
COPY FROM(IN1) TO(T1) USING(CTL2)
SPLICE FROM(T1) TO(OUT) ON(1,7,CH) KEEPNODUPS -
  WITH(81,1) USING(CTL3)
/*
//CTL1CNTL DD *
  INREC OVERLAY=(81:C'BB')
/*
//CTL2CNTL DD *
  INREC OVERLAY=(81:C'VV')
/*
//CTL3CNTL DD *
  OUTFIL FNAMES=OUT,OMIT=(81,2,CH,EQ,C'BB'),
    BUILD=(1,80)
/*
Back to top
View user's profile Send private message
arnab

New User


Joined: 13 Mar 2006
Posts: 59
Location: UK

PostPosted: Wed May 02, 2007 10:39 pm
Reply with quote

Thanks a lot Frank. I got the expected result using the code.
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 FTP VB File from Mainframe retaining ... JCL & VSAM 4
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
Search our Forums:

Back to Top