Hi List,
we always put description info on a certain line numbers in our programs...
The method i've been using to get that info has failed at times.
Can anyone provide with a way to get text at a certain line # in a program
thanks
jeff
Or is there a way to convert and entire pxplus program to a text file and then i can parse it?
Hi Jeffrey,
Take a look at the utility program "*pg.cnv". It can be used to convert a program file to a text file (and vice versa).
Regards,
Rob Leighton
Hi Rob, that worked great but then it failed at one account...it seems to come back still encrypted...
all i'm doing is the following
call "*pg.cnv","PROG1","s:\jeff\jeff.txt"
and at one account it comes back encrypted ..if you have any ideas that would be great...
I dont think it is pxplus version because i have it working on an old version and a new version...
Jeff,
I think you are saying that the the new program is created, but it is compiled PxPlus code rather than a text file.
If that is the case, you just need to make sure that there is an existing text file there before you call *pg.cnv. If there isn't, it will create a PxPlus program.
You will need to add error trapping, but try this:
erase "s:\jeff\jeff.txt"
serial "s:\jeff\jeff.txt"
call "*pg.cnv","PROG1","s:\jeff\jeff.txt"
that was it.
thank you so much.
i'm getting 100% hits now
Were you having trouble with lst(pgm(x,tcb(12))) where x is the line number? This has always worked for me unless the program is password protected.
Hi Ken,
this does indeed work: lst(pgm(x,tcb(12)))
i should have clarified that I was trying to access the line # from another running program
so PR0G01 is running - it is a utility that searches Program Descriptions in other programs.
PROG01 reads thru a directory that contains: PR0G02, PROG03 etc
and i want to get say line 10 from PR0G02 AND PROG03....
that is what i was trying to accomplish
and so far that *pg.cnv is the best i have...
it converts program to text and i read thru until i encounter line #
thanks
jeff
Jeff,
There may be a better way, but just save the program below and run it. It should return the contents of line 10.
The called routine is simply a modified version of *pg.cnv, but serves your purpose of simply grabbing a specific line instead of converting the program.
0050 call pgn+";get_line","PROG1","",10,line$
0060 print line$
0090 end
0500 ! ^500
0510 GET_LINE:
0520 enter prog$,passwd$,line,line$,err=*next
0530 line$="",p$=pgn
0540 x$=lst(pgm(tcb(4)+1)); execute x$(5),err=*end
0550 load prog$; password passwd$; line$=lst(pgm(line)); load p$; goto GET_LINE_EXIT
0560 GET_LINE_EXIT:
0570 exit