PH and text files
Lemin, Graeme
Graeme.Lemin@team.telstra.com
Wed, 13 Apr 2005 16:06:21 +1000
Hi Aci
We have a dummy file defined in our dictionary, called ph_rec_132, with a single field record name record_132. Assuming you have something similar, you could use the 'assign' statement in VMS to create an association between your input file and your dummy file:
Assign your_input_file ph_rec_132
Then, use the 'index' command to find the position of the commas:
access ph_rec_132
def d_indx1 num*4 = index(record_132,",")
d_indx1 now contains the location of the first comma, so you could do something like:
define field_1 char*40 = ph_rec_132[1:(d_indx1 - 1)]
Now find the second comma:
def d_indx2 num*4 = index(record_132[(d_indx1 + 1):132],",")
The above line restarts the comma search at the first character after the first comma.
So your second field would be:
define field_2 char*4 = ph_rec_132[(d_index1 + 1):(d_index2 - 1)]
and so on....
def d_indx3 num*4 = index(record_132[(d_indx1 + d_indx2 + 1):132],",")
def d_indx4 num*4 = &
index(record_132[(d_indx1 + d_indx2 + d_indx3 + 1):132],",")
def d_indx5 num*4 = &
index(record_132[(d_indx1 + d_indx2 + d_indx3 + d_indx4 + 1):132],",")
def d_indx6 num*4 = &
index(record_132[(d_indx1 + d_indx2 + d_indx3 + d_indx4 + &
d_indx5 + 1):132],",")
def d_indx7 num*4 = &
index(record_132[(d_indx1 + d_indx2 + d_indx3 + d_indx4 + &
d_indx5 + d_indx6 + 1):132],",")
I hope this makes sense!
regards
Graeme Lemin
Media Solutions - Telstra
(Black Diamond Technologies)
Melbourne, Australia
(03) 8695 7040
> -----Original Message-----
> From: powerh-l-admin@lists.sowder.com [SMTP:powerh-l-admin@lists.sowder.com] On Behalf Of Aci Polajnar
> Sent: Wednesday, 13 April 2005 3:31 pm
> To: PowerH List
> Subject: PH and text files
>
> Hi there
>
> Anybody, is there a way to read variable length text file, comma delimited usinq QUIZ. My platform is ALPHA/VMS and PH-710G
>
> Thanks and best regards!
> --
> ________________________________________________________________
>
> Aci Polajnar Tel : +386(0)3 4274174
> IS Consultant Fax : +386(0)3 4274198
> Razvojni Center Celje e-mail: acip@rcc-irc.si <mailto:acip@rcc-irc.si>
> 3000 Celje, Slovenia URL : <http://www.rcc-irc.si>
> ________________________________________________________________
>