How to read comma delimited file in PL1



IBM's cross-platform compiler PL/I for MVS, VM & VSE, OS/390 and Enterprise PL/I for z/OS

How to read comma delimited file in PL1

Postby gvkvarma » Wed May 19, 2010 11:41 pm

Hi,

How to read comma delimited file in PL1? Do know the length of the file ?
For example X = 'abc,bcde,12345.67,' Need to move VAL1 = abc , VAL2 = bcde and VAL3 = 12345.67


Thanks in advance
gvk
gvkvarma
 
Posts: 2
Joined: Wed May 19, 2010 11:24 pm
Has thanked: 0 time
Been thanked: 0 time

Re: How to read comma delimited file in PL1

Postby Kim » Mon May 24, 2010 8:51 am

Just quickly, if you know how many fields there are in each record - move the record to a char var variable, index for each comma and substr the field out. If you don't know how many fields or want to be safe always check the return value is > zero.
You can automate this by putting into a do while loop and updating the indexes at the bottom of each loop.

Hope that helps, Kim
Kim
 
Posts: 1
Joined: Mon May 24, 2010 8:41 am
Has thanked: 0 time
Been thanked: 0 time

Re: How to read comma delimited file in PL1

Postby gvkvarma » Tue May 25, 2010 12:28 am

Thanks Kim for your Help
gvkvarma
 
Posts: 2
Joined: Wed May 19, 2010 11:24 pm
Has thanked: 0 time
Been thanked: 0 time


Return to PL/I

 


  • Related topics
    Replies
    Views
    Last post