Need a easytrieve logic of matching and replace a string

Ask/Clarify the questions on EASYTRIEVE

Moderators: DikDude, Moderator Group

Post Reply
a.venki.subbu@gmail.com
Member
Posts: 1
Joined: Wed Dec 21, 2011 12:17 pm

Need a easytrieve logic of matching and replace a string

Post by a.venki.subbu@gmail.com » Wed Jan 04, 2012 12:00 pm

Please help me a sort for changing the string by matching the account in input file A & B

Input file:
A/
1 postion and length 1 : H
18 postion and length 4 : PNOC
26 postion and lenght 10 : Account


B/Need to match to the input file with starting 1 position to length 10

The input files are having RECFM=FB and LRECL=424
Matching criteria:

1/match the accounts in Input file A: Start position 26 and Length 10 with Accounts in Input file B
2/and 1st position letter is H

Once it matches the accounts in both the files and replace the PNOC to PPNN in postion 18 and length 4
into the output file..



For ex:
Input file A:

----+----1----+----2----+----3----+----4--
H0001000017601855PNOC1004J559274890
S0024000017600323
S0023000017600323
H0001000017631106PNOC1002J053242468
P0001000017601855
P0002000017601855
H0001000017649369PNOC1001J393673513187889392
CH001000017631106
CD001000017631106
D000600001763110620111209233338
D000100001763110620111201121001 182552768



Input file B:
----+----1----+----2----+----3----+----4--
J559274890
J053242468


Output file:
----+----1----+----2----+----3----+----4--
H0001000017601855PPNN1004J559274890
S0024000017600323
S0023000017600323
H0001000017631106PPNN1002J053242468
P0001000017601855
P0002000017601855
H0001000017649369PNOC1001J393673513187889392
CH001000017631106
CD001000017631106
D000600001763110620111209233338
D000100001763110620111201121001 182552768

DikDude
Moderator
Posts: 1001
Joined: Fri Jul 22, 2011 8:39 am
Location: usa

Post by DikDude » Wed Jan 04, 2012 10:25 pm

Hopefully, you are not looking for someone to write the code for you. . . These are Help forums rather than do-my-work-for-me forums. . .

When posting code, data, jcl, info from a screen, etc, you need to use the Code tag

Code: Select all

----+----1----+----2----+----3----+----4-- 
H0001000017601855PNOC1004J559274890 
S0024000017600323 
S0023000017600323 
H0001000017631106PNOC1002J053242468 
P0001000017601855 
P0002000017601855 
H0001000017649369PNOC1001J393673513187889392 
CH001000017631106 
CD001000017631106 
D000600001763110620111209233338 
D000100001763110620111201121001 182552768 
Otherwise alighment is lost and readability awful. . . "Wrap" your info to be Code'd between (code) and (/code) using [] instead of (). Use the Preview to see your post as it will appear to the forum rather than how it appears in the Reply editor. Then Submit when your post appears the way you want.

What is the maximum number (if any) of the records in file B?
Have a good one

kdevaraj
Member
Posts: 1
Joined: Wed Jan 02, 2013 9:11 pm

Post by kdevaraj » Thu Jan 17, 2013 11:13 pm

Venki,
This can be done using the SORT..

SYSIN DD*
OPTION COPY
OUTREC FINDREP= 'STRING'

DikDude
Moderator
Posts: 1001
Joined: Fri Jul 22, 2011 8:39 am
Location: usa

Post by DikDude » Fri Jan 18, 2013 12:45 am

It is good to want to help, but you should only post tested "solutions".

Your code does NOT even look like the request. . . :(

Among other things, the request specifies 2 input files . . .

Suggest you run your code and show how it meets the request.

NicC
Active Member
Posts: 650
Joined: Sun Jul 24, 2011 5:27 pm
Location: Down on the pig farm

Post by NicC » Fri Jan 18, 2013 2:01 am

Also, the request was over a year ago and specified an Easytrieve solution.
Regards
Nic

Post Reply

FREE TUTORIALS

Tutorials
Free tutorials from mainframegurukul
  • JCL Tutorial
    Covers all important JCL concepts.
  • Cobol Tutorial
    This tutorials covers all Cobol Topics from STRING to COMP-3.
  • DB2 Tutorial
    DB2 Tutorial focuses on DB2 COBOL Programming.
  • SORT Tutorial
    This Tutorial covers all important aspects of DFSORT with examples
  • CICS Tutorial
    This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions



Other References
Mainframe Tools and others