Displaying Columns



IBM's Command List programming language & Restructured Extended Executor

Displaying Columns

Postby Mark Harvard » Fri Nov 12, 2021 8:52 pm

I have a table in a sequential dataset and I need to read the columns down. Is it possible to use EXECIO and iterate through each column and store them in a nested array?
Mark Harvard
 
Posts: 4
Joined: Wed Oct 13, 2021 11:24 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Displaying Columns

Postby prino » Fri Nov 12, 2021 9:01 pm

Maybe you can show what you actually want to do with some example data, a picture paints a thousand words.

And REXX doesn't have arrays, let alone nested arrays.
Robert AH Prins
robert.ah.prins @ the.17+Gb.Google thingy
User avatar
prino
 
Posts: 635
Joined: Wed Mar 11, 2009 12:22 am
Location: Vilnius, Lithuania
Has thanked: 3 times
Been thanked: 28 times

Re: Displaying Columns

Postby Mark Harvard » Fri Nov 12, 2021 9:07 pm

I have a table,

    header_title_1 header_title_2
    data

Mark Harvard
 
Posts: 4
Joined: Wed Oct 13, 2021 11:24 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Displaying Columns

Postby Mark Harvard » Fri Nov 12, 2021 9:17 pm

I have a table,

    header_title_1 header_title_2
    data. data
    data data
    data data


I want to grab header_title_1, and all data in that column, store it, then move to the next column and do the same thing for n amount of data.
I am still new to Rexx but I know how to do it in python and try to associate the terminology. I know they don't have arrays, but called compound variables
Mark Harvard
 
Posts: 4
Joined: Wed Oct 13, 2021 11:24 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Displaying Columns

Postby sergeyken » Fri Nov 12, 2021 10:51 pm

0) Learn how to use the CODE tags in your postings

1) how do you distinguish data between different columns?
- each column data begins in a specific fixed position?
- column data are separated by a specific character/string?
- something else?

2) where do you plan to "store" the data extracted from each column?
- in an array?
- in a separate dataset?
- somewhere else?

3) the "saving" one column at a time doesn't make sense: you would need to re-read the input dataset again, and again - for each one of your columns.
It would be much better saving data for ALL columns in parallel, from each single record
Javas and Pythons come and go, but JCL and SORT stay forever.
User avatar
sergeyken
 
Posts: 409
Joined: Wed Jul 24, 2019 10:12 pm
Has thanked: 6 times
Been thanked: 40 times

Re: Displaying Columns

Postby sergeyken » Fri Nov 12, 2021 11:11 pm

. . . . . . . . . . .
"EXECIO * DISKR INPUTDD (FINIS"
Do L = 1 by 1 While Queued() > 0
   Parse Pull Col1.L Col2.L Col3.L ... ColN.L
   /* or, for comma-separated columns       */
   /* Parse Pull Col1.L ',' Col2.L ',' Col3.L ',' ... ',' ColN.L ',' */   
   /* or, for columns with fixed size (let's say 10 bytes each)      */
   /* Parse Pull Col1.L +10 Col2.L +10 Col3.L +10 ... +10 ColN.L +10 */
   /* or, for columns with fixed positions      */
   /* Parse Pull Col1.L =10 Col2.L =20 Col3.L =30 ... =90 ColN.L =100 */
End L
L = L - 1
/* at this point:                                                                         */
/*      L                   = the number of elements,                                     */
/*      Col1.1 ... ColN.1   - headers of each column 1 to N                               */
/*      Col1.X ... ColN.X   - data values for columns 1 to N, from lines 2 to max lines read */
. . . . . . . . . . . .
 
Javas and Pythons come and go, but JCL and SORT stay forever.
User avatar
sergeyken
 
Posts: 409
Joined: Wed Jul 24, 2019 10:12 pm
Has thanked: 6 times
Been thanked: 40 times

Re: Displaying Columns

Postby Pedro » Sun Nov 14, 2021 11:28 am

I know they don't have arrays, but called compound variables


I suggest you read about stem variables in the rexx manuals. Sergeyken has provided a good example of how to use one.

How the data is delimited is important. It might be tricky if some of columns have text with imbedded blanks.

Also learn about the PARSE statement.
Pedro Vera
User avatar
Pedro
 
Posts: 684
Joined: Thu Jul 31, 2008 9:59 pm
Location: Silicon Valley
Has thanked: 0 time
Been thanked: 53 times


Return to CLIST & REXX

 


  • Related topics
    Replies
    Views
    Last post