Opening a file and performing some Logic



IBM's Command List programming language & Restructured Extended Executor

Opening a file and performing some Logic

Postby ram23bal » Sat May 24, 2008 4:11 pm

Hi friends


I want to open a PS file in rexx and do some logic.
How can i read a particular column in a file.


say for example

file name - TEST.RAM.REXX

----5----10----15----20----
801010100 300801010100
805555500 300811111110
801010133 300801636810
803212300 300801013127


in this PS file i should select

801010100
805555500
801010133
803212300

to a variable


[b]please help me out. Iam new to REXX and mainframes.[/b]
ram23bal
 
Posts: 33
Joined: Sat May 24, 2008 3:57 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Opening a file and performing some Logic

 

Re: Opening a file and performing some Logic

Postby MrSpock » Sat May 24, 2008 5:25 pm

You can use:

PARSE.

LEFT.

SUBSTR.

WORD.

Based on your example, I'd probably choose the LEFT command.
User avatar
MrSpock
Global moderator
 
Posts: 810
Joined: Wed Jun 06, 2007 9:37 pm
Location: Raleigh NC USA
Has thanked: 0 time
Been thanked: 2 times

Thank you

Postby ram23bal » Sun May 25, 2008 2:16 pm

Hi thanks for the reply,


Can you please send the syntax...

and also I cant find a good book or document on REXX MAIN FRAMES .... can you please recomend me one...?
ram23bal
 
Posts: 33
Joined: Sat May 24, 2008 3:57 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Opening a file and performing some Logic

Postby dick scherrer » Sun May 25, 2008 6:38 pm

Hello,

Did you click on the posted links in the reply from MrSpock? The "LEFT" link shows the syntax as well as a few examples.

If you download that entire document (there is a PDF download link neat the top, right of the page), you will have a very good source of REXX info. I recommend downloading the document as you will use it often (and i find it more handy to have the doc on my machine rather than the internet).
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6304
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 91 times

Re: Opening a file and performing some Logic

Postby ram23bal » Mon May 26, 2008 3:34 pm

Hi thank you all for ur reply


I have gone through link but it didnt help me. :(
Iam unable to read the content of the file.
Is there any other way to read the content of the file amd move them to a variable name....
PLZ help me out.
ram23bal
 
Posts: 33
Joined: Sat May 24, 2008 3:57 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Opening a file and performing some Logic

Postby MrSpock » Mon May 26, 2008 7:06 pm

Presuming that the dataset with your data in allocated to SYSUT1:

/* REXX */                                         
eof = 0                                           
Do Until eof                                       
  "EXECIO 1 DISKR sysut1"                         
  If rc <> 0 Then eof = 1                         
  Else                                             
    Do                                             
      Pull rec
      first_ten = Left(rec,10)
    End                                           
End                                               
"EXECIO 0 DISKR sysut1 (FINIS"                                         
Exit 0                   
User avatar
MrSpock
Global moderator
 
Posts: 810
Joined: Wed Jun 06, 2007 9:37 pm
Location: Raleigh NC USA
Has thanked: 0 time
Been thanked: 2 times


Return to CLIST & REXX

 


  • Related topics
    Replies
    Views
    Last post