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
 

 

Update a field in a file with that from another file

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Update a field in a file with that from another file
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

Site Director


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

PostPosted: Mon Apr 30, 2007 7:52 pm    Post subject:
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    Post subject:
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 Moderator


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

PostPosted: Mon Apr 30, 2007 8:50 pm    Post subject:
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    Post subject:
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 Moderator


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

PostPosted: Wed May 02, 2007 8:29 pm    Post subject:
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    Post subject:
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    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 INVALID FIELD OR CONSTANT IN SORTOF ?? Ron Klop DFSORT/ICETOOL 8 Wed Jan 11, 2017 3:44 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 Performing arithmetic on input field zh_lad DFSORT/ICETOOL 31 Tue Dec 06, 2016 8:04 pm
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


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