Page 1 of 1

Opening a file and performing some Logic

PostPosted: Sat May 24, 2008 4:11 pm
by ram23bal
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]

Re: Opening a file and performing some Logic

PostPosted: Sat May 24, 2008 5:25 pm
by MrSpock
You can use:

PARSE.

LEFT.

SUBSTR.

WORD.

Based on your example, I'd probably choose the LEFT command.

Thank you

PostPosted: Sun May 25, 2008 2:16 pm
by ram23bal
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...?

Re: Opening a file and performing some Logic

PostPosted: Sun May 25, 2008 6:38 pm
by dick scherrer
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).

Re: Opening a file and performing some Logic

PostPosted: Mon May 26, 2008 3:34 pm
by ram23bal
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.

Re: Opening a file and performing some Logic

PostPosted: Mon May 26, 2008 7:06 pm
by MrSpock
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