Item Listing in Quiz
Heasman, David
David.Heasman at schroders.com
Wed Feb 6 05:24:27 CST 2008
Hi,
We have a routine on the HP3000 to do this. Looking at it I
think it could be converted to DCL quite quickly.
Here's the code
:help qdefine
USER DEFINED COMMAND FILE: QDEFINE.CMD
anyparm parm=![""]
# ----------------------------------------------------------------------
# Command file to generate a QUIZ report with one data item per line
# (a bit like Query's Report All) for a given file layout
#
# Usage: QDEFINE record [^items] [-ZS]
# or: QDEFINE ^items
#
# record is the name of the record as defined in the dictionary
# items is an indirect file containing the names of items to be
# reported. It can be used with <record> or without.
# Where <record> is specified, default is all items.
# -ZS option means that the ZS-@ items will not be reported.
# Ignored if <items> is specified.
#
# e.g. :QUIZ
# > access D-PORTFOLIO
# > choose PFOLIO-CODE "13293001"
# > :QDEFINE D-PORTFOLIO -ZS > QIN
# > use QIN nolist
# > go
#
setvar mfcmdvers "6.1"
# ----------------------------------------------------------------------
# Handle call from command line - parse parameters
# ----------------------------------------------------------------------
if lft(hpstdin,1)="$" then
if bound(insidempex) and insidempex=1 then
echo ;Sorry, but MPEX simply can't hack this stuff!
return
endif
setvar _ITEM_X "DUMMY"
deletevar _ITEM_@
setvar _ZS TRUE
setvar _ITEMFILE setvar(_RECORD,"")
setvar _PARM ups("!parm")
if _PARM="" then
print !HPFILE;start=6;end=14
return
endif
setvar _TOKEN1 word(_parm,,1)
setvar _TOKEN2 word(_parm,,2)
if _TOKEN2 = "-ZS"
setvar _ZS FALSE
setvar _TOKEN2 ""
endif
if lft(_TOKEN1,1) ="^" then
setvar _MODE 1
setvar _RECORD ""
setvar _ITEMFILE _TOKEN1 - "^"
elseif _TOKEN2 <> ""
setvar _MODE 2
setvar _RECORD _TOKEN1
setvar _ITEMFILE _TOKEN2
if lft(_ITEMFILE,1) = "^" then
setvar _ITEMFILE _ITEMFILE - "^"
endif
else
setvar _MODE 0
setvar _RECORD _TOKEN1
endif
if _ITEMFILE <> "" and not finfo(_ITEMFILE,"exists") then
echo *E* Nonexistent file !_ITEMFILE
return
endif
# MODE: 0 Process Record Layout (with or without -ZS items)
# 1 Process List of items only - without Record Layout
# 2 Process Record but only include items in List
if _MODE <> 1 then
echo set compressed > QSHIN
echo show record !_RECORD >> QSHIN
echo exit >> QSHIN
QSHOW < QSHIN > QDEFINE1
if finfo("QDEFINE1","eof") < 11 and pos("7",PH_VERSION)=0 then
echo *E* The Record !_RECORD was not found in the data
dictionary.>> QDEFI
NE1
endif
endif
if _MODE <> 0
setvar _QSHOW FALSE
!HPFILE !_PARM < !_ITEMFILE
endif
if _MODE <> 1
setvar _QSHOW TRUE
!HPFILE !_PARM < QDEFINE1
endif
return
endif
# ----------------------------------------------------------------------
# Process a file. This will either be a file of item names, or the
# output from QSHOW.
# ----------------------------------------------------------------------
setvar PROCESSING not _QSHOW
setvar n finfo(HPSTDIN,"eof")
setvar NUMITEMS 0
while setvar(n,n-1) >= 0
setvar buf ""
input buf
setvar buf ltrim(buf)
#
----------------------------------------------------------------------
# Processing for QSHOW output
#
----------------------------------------------------------------------
if _QSHOW then
if PROCESSING and (len(buf)=0 OR lft(buf,8)="-- Index") then
setvar PROCESSING false
endif
if word(buf)="*E*" then
echo report tab 001 "!buf" !["&"]
setvar n 0
endif
if PROCESSING then
setvar item lft(buf,24)
if (_MODE = 2 and
bound(_ITEM_![repl(repl(repl(ITEM,".",""),"-","_"),"/","
_")])) or (_MODE = 0 and lft(item,4) <> "Item" and lft(item,4) <> "----"
and (l
ft(item,1) <> "." or lft(item,11) = ".NARRATIVE-")) and
pos("FILLER",item) = 0 a
nd (_ZS or (not _ZS and lft(item,3) <> "ZS-")) then
setvar ITEM repl(ITEM,"."," ")
setvar TYPE rtrim(str(buf,38,14))
setvar LEN min(![str(buf,54,4)],50)
setvar OCCNO setvar(occ, 1)
if str(buf,59,4) <> " "
setvar occ ![str(buf,59,4)]
endif
while occno <= occ
if occ <> 1 then
setvar item word(item) + "(!occno)"
setvar item item + rpt(" ",24-len(item))
endif
echo skip tab 1 "!item =" !["&"]
echo tab 27 !item of !_RECORD !["&"]
if lft(type,5) = "ZONED" or lft(type,4) = "CHAR" then
echo picture "![rpt("^",len)]" !["&"]
endif
if lft(type,5) = "ZONED" or lft(type,3) = "INT" then
echo fill "0" NOBWZ !["&"]
endif
setvar NUMITEMS NUMITEMS + 1
setvar occno occno + 1
endwhile
endif
endif
if lft(buf,9)="-- Record" then
setvar PROCESSING true
echo ; Created by !HPFILE version !mfcmdvers for !HPJOBNAME
echo ; :![finfo(HPFILE,"fname")] !_PARM
echo set nohead
echo page heading !["&"]
echo tab 1 "File: !_RECORD" tab 69 "Record:" !["&"]
echo tab 77 syspage picture "^^" fill "0" !["&"]
echo skip tab 1 "![rpt("-",22)]"
echo report !["&"]
endif
endif
#
----------------------------------------------------------------------
# Processing for file containing list of items
#
----------------------------------------------------------------------
if not _QSHOW
setvar item word(buf)
if _MODE = 1
if NUMITEMS = 0
echo ; Created by !HPFILE version !mfcmdvers for !HPJOBNAME
echo ; :![finfo(HPFILE,"fname")] !_PARM
echo set nohead
echo page heading !["&"]
echo tab 1 "File: [primary-file]" tab 69 "Record:" !["&"]
echo tab 77 syspage picture "^^" fill "0" !["&"]
echo skip tab 1 "![rpt("-",22)]"
echo report !["&"]
endif
echo skip tab 1 "!item =" !["&"]
echo tab 27 !item !["&"]
setvar NUMITEMS NUMITEMS + 1
else
setvar _ITEM_![repl(repl(ITEM,"-","_"),"/","_")] TRUE
endif
endif
endwhile
if _MODE = 1 or _QSHOW then
echo skip 2
echo set page length ![NUMITEMS+3]
endif
:
Good fun, eh?
-----Original Message-----
From: powerh-l-bounces+david.heasman=schroders.com at lists.sowder.com
[mailto:powerh-l-bounces+david.heasman=schroders.com at lists.sowder.com]
On Behalf Of John Backus
Sent: 06 February 2008 04:19
To: John Stires
Cc: powerh-l at lists.sowder.com
Subject: Re: Item Listing in Quiz
John Stires wrote:
> I just had a meeting with my manager who had an interesting request.
> She had someone working for her a while back that had a way, in QUIZ,
> of listing the field name with the contents of that field immediately
> after the item name on the same line; like a verical listing. She is
> looking to avoid records with lots of fields wrapping aroung and
> missing the field names that go with the data. This guy told her that
> this was a function within PowerHouse. It turned out looking
> something like this:
>
> Branch_ID 01
> Location Chicago
> Type Sales
> Branch_ID 02
> Location St. Louis
> Type Sales Support
>
> I played around with it a bit, but could not find anything that would
> even come close accomplishing this. I could write a .COM file that
> might do the trick by capturing the fields from a QSHOW listing, but
> she says that it was supposedly all within PowerHouse. We are running
> 7.10.G1 on OpenVMS 8.3.
>
> Can anyone out there offer me some help?
>
> Thanks,
>
__________________________________________________________________
This message might contain confidential information. If it has been sent to you in error please do not forward it or copy it or act upon its contents, but report it to postmaster at schroders.com
Schroders has the right lawfully to record, monitor and inspect messages between its employees and any third party. Your messages shall be subject to such lawful supervision as Schroders deems to be necessary in order to protect its information, its interests and its reputation.
Schroders prohibits and takes steps to prevent its information systems from being used to view, store or forward offensive or discriminatory material. If this message contains such material please report it to abuse at schroders.com
Schroders does not normally accept or offer business instructions via email unless prior agreements are in place. Any action that you might take upon this message might be at your own risk.
Schroder Investment Management Limited
31 Gresham Street
London EC2V 7QA
Authorised and regulated by the Financial Services Authority. Schroder Investment Management Limited is entered on the FSA register under the following register number: 119348
Registered Office
31 Gresham Street
London EC2V 7QA
Registered number 1893220
VAT registration number 243 8687 30
More information about the powerh-l
mailing list