getting output from a flat file

Ask/Clarify the questions on TSO, CLIST & REXX

Moderators: Veera, Moderator Group

Post Reply
naren123
Member
Posts: 1
Joined: Mon Dec 24, 2012 1:49 am

getting output from a flat file

Post by naren123 » Mon Dec 24, 2012 1:53 am

I am trying to develop a rexx code which will give the age of the person when i enter his/her name.

The flat file will be as follows:

david 20
anjan 23
hari 22
so on.....

the age starts at, say, 10th column.

When i enter a name, i want the REXX code to do the following :
1. Refer the PS file.
2. Search for the name in the flat file.
3. If found, then give only his/her age as the output.

for the first one.. i used execio.
for the third.. i can use substr..
my doubt is how to match the entered name with that of the name in the flat file??
I'm just a beginner.. so pls help me out..

MrSpock
Active Member
Posts: 273
Joined: Wed Jun 27, 2007 5:37 pm

Post by MrSpock » Mon Dec 24, 2012 2:18 am

Presuming that you've broken down the input record into two fields, name and age, and then prompted for the input age, let's say name_in, then it's just a simple equivalency comparison:

If name_in == name Then Say name"'s age is" age.

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

Post by DikDude » Fri Dec 28, 2012 1:37 am

How many places to you plan on posting the same question . . . :(

vijayganesan
Member
Posts: 1
Joined: Thu Mar 01, 2012 12:15 pm

Post by vijayganesan » Tue Jan 01, 2013 10:39 pm

This is very simple.
You can use the Word function in REXX.
Example:
1)read each line
2)name=word(string,1),age=word(string,2)
3)match the user entered word with the "name" using if condition
4) matches take second word "age" and return to user.
5) not match iterate.

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