update colums, if match found in file1 and file2.

Share a quote, a general thought, jokes or one liners here.
Post Reply
Puja Motwani
New Member
Posts: 9
Joined: Mon Jan 18, 2016 1:46 pm

update colums, if match found in file1 and file2.

Post by Puja Motwani »

Hi all, how to update colums, if match found in file1 and file2.

Can anyone help
User avatar
Robert Sample
Global Moderator
Global Moderator
Posts: 1895
Joined: Fri Jun 28, 2013 1:22 am
Location: Dubuque Iowa
United States of America

Re: update colums, if match found in file1 and file2.

Post by Robert Sample »

What "colums" (sic)? You posted in the thought of the day, general talk & jokes forum so you're obviously NOT talking about DB2 columns (which is the correct spelling). Furthermore, you did not provide any context for "file1" and "file2" -- are these input data sets? Are they driving a matching process? Are they merely random files?

In other words, based upon what you've posted so far there is no way anyone could possibly help you as it is not clear what your problem is, what your environment is, nor what you have already tried.
User avatar
Anuj Dhawan
Founder
Posts: 2802
Joined: Sun Apr 21, 2013 7:40 pm
Location: Mumbai, India
Contact:
India

Re: update colums, if match found in file1 and file2.

Post by Anuj Dhawan »

This definitely needs more explanation as Robert has said too. What kind of solution are you looking for COBOL or SORT or anything else?
Thanks,
Anuj

Disclaimer: My comments on this website are my own and do not represent the opinions or suggestions of any other person or business entity, in any way.
Puja Motwani
New Member
Posts: 9
Joined: Mon Jan 18, 2016 1:46 pm

Re: update colums, if match found in file1 and file2.

Post by Puja Motwani »

Hey, sorry for not being clear.

There are two files and need to do it using sort.
User avatar
Anuj Dhawan
Founder
Posts: 2802
Joined: Sun Apr 21, 2013 7:40 pm
Location: Mumbai, India
Contact:
India

Re: update colums, if match found in file1 and file2.

Post by Anuj Dhawan »

This is a classic case of JOINKEYs in SORT, unless there is more to what meets the eyes. See below exmaple:

Code: Select all

//JKE1  EXEC  PGM=SORT
//SYSOUT    DD  SYSOUT=*
//SORTJNF1 DD *
Roses          03  Red
Daisies        06  Orange
Roses          04  Pink
Daisies        02  Yellow
Roses          06  Yellow
Daisies        12  Lilac
Roses          09  Blue
/*
//SORTJNF2 DD *
Red      Lilies          InStock
Red      Roses           InStock
Orange   Daisies         SoldOut
Pink     Roses           SoldOut
Yellow   Daisies         InStock
Yellow   Roses           Ordered
Lilac    Daisies         SoldOut
White    Daisies         InStock
/*
//SORTOUT DD SYSOUT=*
//SYSIN    DD    *
* Control statements for JOINKEYS application
  JOINKEYS FILE=F1,FIELDS=(1,15,A,20,8,A)
  JOINKEYS FILE=F2,FIELDS=(10,15,A,1,8,A)
  REFORMAT FIELDS=(F1:20,8,1,15,F2:26,10,F1:16,2)
* Control statements for main task (joined records)
  OPTION COPY
  OUTFIL REMOVECC,
    HEADER2=(1:'Color',11:'Flower',26:'Status',36:'Per Pot',/,
             1:7'-',11:14'-',26:7'-',36:7'-'),
    BUILD=(1:1,8,11:9,15,26:24,10,
      36:34,2,ZD,M10,LENGTH=7)
/*
The output file will have RECFM=FB and LRECL=42. It will contain the paired records from the two files reformatted as follows:

Code: Select all

Color     Flower         Status    Per Pot
-------   -------------- -------   -------
Lilac     Daisies        SoldOut        12
Orange    Daisies        SoldOut         6
Yellow    Daisies        InStock         2
Pink      Roses          SoldOut         4
Red       Roses          InStock         3
Yellow    Roses          Ordered         6
If there are more to it - post specific examples.
Thanks,
Anuj

Disclaimer: My comments on this website are my own and do not represent the opinions or suggestions of any other person or business entity, in any way.
Post Reply

Create an account or sign in to join the discussion

You need to be a member in order to post a reply

Create an account

Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute

Register

Sign in

Return to “Thought of the Day, General Talk & Jokes.”