Lab Note #4: Query UDP: Dateproc

Included in Tools version C0000I is a QUERY user-defined-procedure, UDP, named DATEPROC. UDP allows
you to extend the reporting capability of QUERY, the IMAGE database reporting tool, included with your HP3000.
Documentation for UDP can be found in your QUERY/V Reference Manual, part 30000-90042, Appendix F User Defined
Procedures.


You write a procedure in your chosen programming language and compile to either a USL if your doing a CM
compile, or an NMOBJ for a NM compile. If using CM, place the procedure into your logon group or pub SL where the CM
QUERY does a dynamic lookup to find it. For NM QUERY, place the procedure in any XL of your choice. Then you must
run NM QUERY, specifying your XL in the XL- list parameter giving the full filename of your XL. Examples:

         :RUN QUERYCM.PUB.SYS
         :RUN QUERYNM.PUB.SYS;XL="myxl.pub.applacct"

DATEPROC is provided for your QUERY reports to convert the internal A0 date format to external 00 display
format. DATEPROC is very simple in that it only changes the character in the column you specify from A-E to 0-4. The user
can provide one integer parameter to a UDP. DATEPROC uses this as the column number of the output line for the report.
Examining the report example below, a date is formatted on the report line, then DATEPROC is called to check and convert
the leading year character. This example assumes the field DATE is in Year-Month-Day format, YYMMDD.

         >R
         >>D1, DATE, 8,E1
         >>D1, DATEPROC (1),/
         >>E1,"XX/XX/XX"
         >>END

Note that the provided DATEPROC in tools is for CM QUERY. We have placed a NM version on the web under Technical
Support, Download Files.

I have examples of the procedure DATEPROC in SPL, FORTRAN, COBOL, PASCAL and C, for both CM and NM
compilers. They are available on request to technote@exegesys.com.


Lab Note #4: Query UDP: Dateproc, 13 Sep 1999 Keven Miller
Feedback and topic suggestions are welcome and can be sent to technote@exegesys.com.

Lab Notes are hints & technical notes from the "Labyrinth" (the eXegeSys software lab); so named because of our complex
mission to assimilate understanding the eRP product suite, it's source code, and our development procedures.