PDL to CSV
Hodson, Paul EDUC:EX
Paul.M.Hodson at gov.bc.ca
Wed Mar 11 14:00:50 CDT 2009
With HELP THANKS ALL . ( Peter B especially)
I was able to convert PDL to an excel spreadsheet. The spreadsheet lists
the column name, data type and the description.
Input Sample
Usage BCENTS NUMERIC Size 12
&
Input Scale 2
&
Significance 1
&
Leading Sign "-"
&
Picture " ^,^^^,^^^,^^^.^^"
&
Default Item Datatype INTEGER SIGNED SIZE 8
&
Description "BCENTS: BIG CENTS. Use for money values to be stored
" &
"with integer accuracy up to 10 billion dollars.
" &
"And to be stored in the database with NO decimal portion,
" &
"but stored as integer cents.
" &
"Conversion to dollars to be done at PowerHouse level
" &
"using input and output scale, and let = * 100 or / 100.
" &
"Input scale defaults to 2.
" &
"Default output scale is 1, because it matches the default
" &
"picture, ie displaying the cents.
" &
"Output scale defaults to 2 to allow putting in values
" &
"without a decimal point and having the cents
automatically " &
"added.
" &
"This should suit most applications, but if need to input
" &
"cents all the time, can override the input scale at
screen " &
"level, and if need to display dollars only, override the
" &
"output scale at screen level.
"
Output Sample
BCENTS |NUMERIC Size 12 |
BCENTS: BIG CENTS. Use for money values to be stored with integer
accuracy up to 10 billion dollars. And to be stored in the database with
NO decimal portion, but stored as integer cents. Conversion to dollars
to be done at PowerHouse level using input and output scale, and let = *
100 or / 100. Input scale defaults to 2. Default output scale is 1,
because it matches the default picture, ie displaying the cents. Output
scale defaults to 2 to allow putting in values without a decimal point
and having the cents automatically added. This should suit most
applications, but if need to input cents all the time, can override the
input scale at screen level, and if need to display dollars only,
override the output scale at screen level.
Here are the steps:
1) create an rms table called PDL with an item PDL_LINE as follows:
Record: PDL
of File: PDL
Organization: SEQUENTIAL
Type: RMS
Open: PDL
Record Format: Fixed
Supersede: No
Record Size: 80 Bytes
-- Record Contents --
Item Type Size Occ
Offset
PDL_LINE CHARACTER 80
0
2) create the fdl
$anal/RMS/FDL
3) Generate the PDL
$qshow
> set lang pdl
> gen element ALL
Default device is disc file QSHOGEN.PDL.
The file XXX:QSHOGEN.PDL; already exists. Cre
ate new version?y
> Exit
4) Convert it
$convert/fdl=pdl.fdl qshogen.pdl pdl.dat/pad=" "
5) Run this QTP program
$qtp
request element_desc input noli process noli
Access PDL
select if PDL_LINE[1:6] <> " Help" and &
(PDL_LINE[1:5] = "Usage" or &
PDL_LINE[1:7] = "Element" or &
PDL_LINE[1:13] = " Description" or &
PDL_LINE[1:15] = ' "' or &
PDL_LINE[1:20] = " ")
Temp REC_COUNT
Item REC_COUNT = 1 IF PDL_LINE[1:7] = "Element" or
&
PDL_LINE[1:5] = "Usage"
&
else 2 IF PDL_LINE[76:1] = '"'
&
else 3 IF PDL_LINE[1:20] = " "
TEMP CSV varchar size 2047
define d_CRVAL int*2 = 13
define d_LFVAL int*2 = 10
define d_CRLF char*2 = char(d_CRVAL)[1:1] + char(d_LFVAL)[1:1]
Item CSV = PDL_LINE[9:33] + '|' + PDL_LINE[42:30] + '|'
&
IF 1 = REC_COUNT
&
else TRUNCATE (CSV ) + ' '+ PDL_LINE[16:60]
&
IF 2 = REC_COUNT
Subfile META keep portable if 3 = REC_COUNT inc CSV, D_CRLF
go
6) Copy the META.PS to the desktop
7) Open the META.PS from excel noting it is delimited by a "|"
From: Hodson, Paul EDUC:EX
Sent: March-02-09 9:10 AM
To: 'powerh-l at lists.sowder.com'
Subject: PDL to CSV
Hello,
We about 6000 elements in a OpenVMS powerhouse dictionary and would like
to list the element with description in an excel spreadsheet.
Does anyone have a utility to take PDL( specifically elements) and
produce a CSV format?
So for example
Input
Element ACCPAC_SIN_FIRST3 CHARACTER Size 5
&
Default Item Datatype CHARACTER SIZE 5
&
Description "First 3 digits of the Social Insurance Number from the
" &
"Accounts Receivable. Separately contained in the AR.
" &
Output like...
ACCPAC_SIN_FIRST3
CHARACTER Size 5
First 3 digits of the Social Insurance Number from the Accounts
Receivable. Separately contained in the AR.
Alternative may be access to the metadata structures but I am not sure
if that access is available.
Thanks in advanced.
Paul
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.sowder.com/pipermail/powerh-l/attachments/20090311/3fcbad3a/attachment-0001.htm
More information about the powerh-l
mailing list