Change record by key

JES, JES2, JCL utilities, IDCAMS, Compile & Run JCLs, PROCs etc...
PRDVCF
Posts: 6
Joined: Thu Nov 17, 2022 7:56 pm
Skillset: JCL, Clists
Referer: Web search

Change record by key

Postby PRDVCF » Thu Nov 17, 2022 8:23 pm

I have two equal files ( Dsorg=PS and RecFm=FB ). The first file just have records from 1 to 8. The second have from 1 to 132

File 1
000001 ATMLERH
000002 ATMTRNAC
000003 CMAILRH
000004 DB2FREPK
000005 DB2LOGMB

File 2
000001 ATMLERH COBCICAAB6AATMISA
000002 ATMTRNACCOBCICNAB6AATMGRL
000003 CMAILRH COBCICAAB6AGRL
000004 DB2FREPKCOBBA2AAA6ASYS
000005 DB2LOGMBCOBBA2AAA6ASYS

What I need is change in file 2 all char's on column 18 ( as example ), but only the records founded in file 1.
I have this by clist, which submits a job for each record. That's not so productive as make this only one time.
Does anyone knows how to do it in other way?

User avatar
sergeyken
Posts: 458
Joined: Wed Jul 24, 2019 10:12 pm
Skillset: Assembler, JCL, Utilities, PL/I, C/C++, DB2, SQL, REXX, COBOL, etc. etc. etc.
Referer: Internet search

Re: Change record by key

Postby sergeyken » Thu Nov 17, 2022 9:15 pm

PRDVCF wrote:I have two equal files ( Dsorg=PS and RecFm=FB ). The first file just have records from 1 to 8. The second have from 1 to 132

Those are DATASETS, never FILES.
In mainframe world the word "file" is somehow equivalent to "DDNAME".
What you are talking about, are DATASETS, identified by their DSNAMES.

PRDVCF wrote:File 1

Code: Select all

000001 ATMLERH
000002 ATMTRNAC
000003 CMAILRH
000004 DB2FREPK
000005 DB2LOGMB


File 2

Code: Select all

000001 ATMLERH COBCICAAB6AATMISA
000002 ATMTRNACCOBCICNAB6AATMGRL
000003 CMAILRH COBCICAAB6AGRL    
000004 DB2FREPKCOBBA2AAA6ASYS    
000005 DB2LOGMBCOBBA2AAA6ASYS    
 


PRDVCF wrote:What I need is change in file 2 all char's on column 18 ( as example ), but only the records founded in file 1.
I have this by clist, which submits a job for each record. That's not so productive as make this only one time.
Does anyone knows how to do it in other way?


You cannot do anything like this using JCL.

You need to get some knowledges about SORT utilities. (Hint: JOIN operation)

https://www-40.ibm.com/servers/resourcelink/svc00100.nsf/pages/zOSV2R3sc236880/$file/iceg200_v2r3.pdf
Javas and Pythons come and go, but JCL and SORT stay forever.

PRDVCF
Posts: 6
Joined: Thu Nov 17, 2022 7:56 pm
Skillset: JCL, Clists
Referer: Web search

Re: Change record by key

Postby PRDVCF » Thu Nov 17, 2022 9:58 pm

Thank you sergeyken.


  • Similar Topics
    Replies
    Views
    Last post