HP OpenVMS Systems

ask the wizard
Content starts here

DCL File Parsing Example? (tab-delimited)

» close window

The Question is:

 
How do you extract data of a "tab delimeted" file using a DCL program?
 
 


The Answer is :

$ close/nolog in
$ open/read in 'p1'
$read_loop:
$ read/error=done in record
$ write sys$output "Record: ''record'"
$ i = 0
$tab_loop:
$ field = f$edit(f$element(i,"  ",record),"COLLAPSE")
$ if f$length(field) .eq. 0 then goto read_loop
$ write sys$output "Field[''i']: ''field'"
$ i = i + 1
$ goto tab_loop
$done:
$ close/nolog in
$ exit

answer written or last revised on ( 10-FEB-2000 )

» close window