IBM REXX Question:
Download Questions PDF

Suppose If there are a set of statements and each has a word "value" in it, If I want to display all these statements so that the word "value" is aligned, then how do
I code this in REXX.
e.g - The value of X is Y.
Wot is its value?
Do u know its value?
I want to know its value?

Answer:

/**REXX**/
ADDRESS TSO
"ALLOC DD(INP1) DA('input-dataset') SHR REUS"
"EXECIO * DISKR INP1 (STEM IN1. FINIS"
MAX_OFFSET = 0
INP_OFFSET = 0
DO I = 1 TO IN1.0
PARSE UPPER VAR IN1.I INP
INP_OFFSET = POS("VALUE",INP)
IF INP_OFFSET > MAX_OFFSET THEN
DO
MAX_OFFSET = INP_OFFSET
END
END
DO I = 1 TO IN1.0
PARSE UPPER VAR IN1.I INP
Z = POS("VALUE",INP)
SAY LEFT(SUBSTR(IN1.I,1,(Z - 1)),(MAX_OFFSET - 1))||,
SUBSTR(IN1.I,Z,20)
END
"FREE DD(INP1)"

Download IBM REXX Interview Questions And Answers PDF

Previous QuestionNext Question
How to code rexx in jcl to read in a lpar
cpu usage file and select 1. date, time 2. some system names 3. cpu usage for each system. The input file has hourly reporting. The output file (CSV)is for excel use. Run in batch mode. Output in FB?
I want to code a REXX Program in order to load many tables in a database simultaneously in a batch fashion. Currently batch codes ar available in which only one job is submitted at a time and this loads only one table. My requirement is that many tables should be loaded at a time when one Job is submitted and can this be done using REXX Tool?