Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

REXX-How to access last element of an array in REXX?

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX
View previous topic :: :: View next topic  
Author Message
thekumar101

New User


Joined: 22 Aug 2012
Posts: 4
Location: India

PostPosted: Wed Aug 22, 2012 3:50 pm    Post subject: REXX-How to access last element of an array in REXX?
Reply with quote

Requirement:
1. File is openened and its content is picked up in an array IP_ARR
2. I only need the last record.

Is there any way to fetch the last record directly (apart from sequentially going thru the flat file and counting the number of records and then using the number to access the array something like IP_ARR.numofrec)?
Back to top
View user's profile Send private message

Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7313

PostPosted: Wed Aug 22, 2012 4:03 pm    Post subject: Reply to: REXX-How to access last element of an array in REX
Reply with quote

Do you have an idea what stemvariable.0 contains? That should get you there.
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1753
Location: Bloomington, IL

PostPosted: Wed Aug 22, 2012 4:05 pm    Post subject:
Reply with quote

  1. Rexx does not have arrays; it has stemmed variables.
  2. The question has nothing to do with arrays.
  3. As with all data sets, if the data set is DSORG=DA or is a RRDS, yes; if it is DSORG=PS or a ESDS, no (if it is DSORG=PO or a KSDS, the concept of "last record" is meaningless).
Back to top
View user's profile Send private message
thekumar101

New User


Joined: 22 Aug 2012
Posts: 4
Location: India

PostPosted: Wed Aug 22, 2012 4:08 pm    Post subject:
Reply with quote

thanks Bill.
But I tried it already. and it's showing the stemvar.0,
although it is suppose to show the number of elements in the array.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7313

PostPosted: Wed Aug 22, 2012 4:51 pm    Post subject: Reply to: REXX-How to access last element of an array in REX
Reply with quote

You'd best post your code.
Back to top
View user's profile Send private message
thekumar101

New User


Joined: 22 Aug 2012
Posts: 4
Location: India

PostPosted: Wed Aug 22, 2012 4:53 pm    Post subject:
Reply with quote

Well, it's working now. Thanks a lot.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7313

PostPosted: Wed Aug 22, 2012 5:00 pm    Post subject: Reply to: REXX-How to access last element of an array in REX
Reply with quote

OK. Typos can kill you in languages where you don't have to explicitly define the data :-)
Back to top
View user's profile Send private message
Anuj Dhawan

Senior Member


Joined: 22 Apr 2006
Posts: 6258
Location: Mumbai, India

PostPosted: Wed Aug 22, 2012 5:07 pm    Post subject:
Reply with quote

Akatsukami wrote:
  1. Rexx does not have arrays; it has stemmed variables. The question has nothing to do with arrays.
  2. As with all data sets, if the data set is DSORG=DA or is a RRDS, yes; if it is DSORG=PS or a ESDS, no (if it is DSORG=PO or a KSDS, the concept of "last record" is meaningless).
  3. Hi, Opal!
I've "corrected" your post, Akatsukami! icon_smile.gif
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Running an REXX EXEC implicitly sho7hills CLIST & REXX 3 Thu Apr 20, 2017 8:14 am
No new posts Need help in REXX CALL program Raje1002 CLIST & REXX 5 Wed Apr 19, 2017 11:18 pm
No new posts REXX cdoe to purge a JOB from spool a... Sulabh Agrawal CLIST & REXX 11 Thu Mar 09, 2017 11:36 am
No new posts Overriding PS data in rexx Shaheen Shaik CLIST & REXX 8 Fri Mar 03, 2017 5:08 pm
No new posts REXX compiled via RXTCOMP sergeyken CLIST & REXX 7 Tue Feb 07, 2017 9:41 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us