/* Rexx ************************************************************/ /* */ /* NAME: I N T A R R A Y */ /* */ /* LOCATION: RKAUUSER (INTARRAY) . */ /* */ /* TYPE: Rexx Exec. */ /* */ /* INVOKED BY: A user. */ /* */ /* INVOCATION: EXEC INTARRAY */ /* */ /* PURPOSE: This Rexx Exec is invoked by an authorized user. */ /* How to create an Internal Array table and look */ /* at data within it. */ /* */ /* */ /* PARAMETERS: N/A */ /* */ /* OUTPUT: */ /* */ /* */ /* MESSAGES: ----- */ /* */ /* EXTERNAL VARS: */ /* */ /* TRAPS: None. */ /* */ /* TABLES: None */ /* */ /* INTERNAL RTNS: N/A */ /* */ /* EXTERNAL RTNS: N/A */ /* */ /* FILES USED: None. */ /* */ /* ENVIRONMENT: This Rexx Exec executes entirely within the */ /* AF/Operator address space or KOG TSO. */ /* */ /* DEPENDENCIES: AF/Operator must be up and running. */ /* */ /* RELATIONS: This Rexx Exec can be run under OG*TSO. */ /* */ /* OPERATION: 01) build internal table. */ /* 02) look at data in table and assign variables */ /* to data. */ /* 03) display data that have a number "one". */ /* 04) display the rest of the data. */ /* */ /* AUTHOR: Edward Schmoeller */ /* */ /* CREATED: Febuary 24, 2010 */ /* */ /*-------------------------------------------------------------------*/ /* */ /* CHANGE LOG: Sequence from latest to earliest (Descending). */ /* */ /* DATE CHANGED BY DESCRIPTION OF CHANGE CHG# */ /* -------- ---------- ----------------------------------- ---- */ /* mm/dd/yy Who dun it Why did you make this change? @001 */ /* */ /*********************************************************************/ /* ------------------------------------------------------------------ */ /* Housekeeping and initialization. */ parse source . . execname . /* Get environment info. */ myrc = 'SYSVGET'("test") /* Get trace indicator. */ if wordpos(execname,test) > 0 then trace r /* Trace or not to trace. */ /* ------------------------------------------------------------------ */ /* Build Internal Array table. */ array = "1 apple washington", "1 apple johnthan", "1 apple granny", "2 orange mandarin", "2 orange tangerine", "2 orange clementine", "2 orange satsuma" /* ------------------------------------------------------------------ */ /* Words and word are TSO / E Rexx string manipulating functions. */ do i = 1 to (words(array)/3) /* look at data in table */ numbr = word(array,i*3-2) /* called array. Assign */ fruit = word(array,i*3-1) /* variables to field. */ type = word(array,i*3-0) if numbr = 1 then do say '* -------------------- *' say '* Number Fruit Type' say '*' numbr fruit type say '*' say '* -------------------- *' end if numbr > 1 then do say '* -- Here is the rest -- *' say '*' say '* 'numbr fruit type say '* -------------------- *' end end