CoolSpools Spool Converter Variables

FAQ: Spool Converter Variables

What are CoolSpools Spool Converter variables?

CoolSpools Spool Converter variables

The CoolSpools Spool COnverter commands that convert spooled files support a number of special values known as CoolSpools Spool Converter variables on certain command parameters. Those special values are replaced at run time with a piece of data, for example a spooled file attribute or some text extracted from inside the spooled file.

Each CoolSpools Spool Converter variable consists of a pre-defined variable name from the list below enclosed in the markers <: ... :> (start of variable marker = left-hand angle bracket followed by a colon, end of variable marker = colon followed by a right-hand angle bracket).

You can define a different pair of markers from <: and :> by adding/changing the environment variables CS_VAR_LEFT_MARKER and CS_VAR_RIGHT_MARKER. For example, if you have CS_VAR_LEFT_MARKER set to $% and CS_VAR_RIGHT_MARKER set to %$, you would use $%PAGSETNBR%$ rather than <:PAGSETNBR:> etc.

These variable names, including the markers, are replaced at run time by the corresponding data value. Variable names are not case-sensitive.

CoolSpools Version 6 introduces support for assigning user-defined names to the data items returned by the <:EXITPGMPOSn:> and <:EXITPGMKEYn:> CoolSpools Spool Converter variables, allowing you to refer to those data items using more meaningful and memorable names. In this release, it is now possible to assign your own names to these variables. For example, the item of data referred to by the first element of the EXITPGMPOS parameter can be referenced as <:EXITPGMPOS1:>. However, if you use the new option to assign your own name to that item of data, perhaps "Customer_number", you can also refer to it as <:Customer_number:>.

Variable name Description

<:PAGSETNBR:>

Page Set Number. This is a sequential number identifying the page set. A page set is a set of pages which will be output to a separate stream file when splitting is occurring.

<:STRPAGNBR:>

Starting page number. The first page number from the spooled file in the stream file being created.

<:ENDPAGNBR:>

Ending page number. The last page number from the spooled file in the stream file being created.

<:EXITPGMPOSn:>

where n is a number from 1 to 99The value of the exit program user-defined parameter selected by the nth element of the EXITPGMPOS command parameter.

If you wish to select text items from the spooled file and use them as variables, but do not wish to call any exit programs, specify EXITPGM(*VAR).

You can assign as name of your own choosing to this item of data by means of the "Variable name" element of the EXITPGMPOS parameter. For example, if you were to specify the variable name "Invoice_number" on the first element of EXITPGMPOS, the CoolSpools Spool Converter variables <:EXITPGMPOS1:> and <:Invoice_number:> could then be used interchangeably.

<:EXITPGMKEYn:>

where n is a number from 1 to 99The value of the exit program user-defined parameter selected by the nth element of the EXITPGMKEY command parameter.

If you wish to select text items from the spooled file and use them as variables, but do not wish to call any exit programs, specify EXITPGM(*VAR).

You can assign as name of your own choosing to this item of data by means of the "Variable name" element of the EXITPGMKEY parameter. For example, if you were to specify the variable name "Customer_number" on the first element of EXITPGMKEY, the CoolSpools Spool Converter variables <:EXITPGMKEY1:> and <:Customer_number:> could then be used interchangeably.

<:CURJOB:>

Current job name

<:CURUSER:>

Current user id

<:CURJOBNBR:>

Current job number

<:CURDATE:>

The current date in the format of the current job (DATFMT attribute).

<:CURDATE*xxx:>

The current date in the format indicated by *xxx, where *xxx is any one of: *YMD, *MDY, *DMY, *YYMD, *MDYY, *DMYY, *CYMD, *CMDY, *CDMY, *ISO, *EUR, *JIS, *JUL, *LONGJUL, *JOB or *SYSVAL.

<:CURDAY:>

The current day of the month as a number 01-31.

<:CURMONTH:>

The current month as a number 01-12.

<:CURYEAR:>

The current year as a number 0001-9999

<:CURYEAR4:>

The current year as a number 0001-9999

<:CURYEAR3:>

The current year as a number c01-c99 where c is 0 for the 20th century and 1 for the 21st.

<:CURYEAR2:>

The current year as a number 01-99.

<:CURTIME:>

The current time in hhmmss format.

<:FROMFILE:>

Spooled file name

<:SPLNBR:>

Spooled file number

<:SPLJOB:>

Spooled file job name

<:SPLUSER:>

Spooled file user name

<:SPLJOBNBR:>

Spooled file job number

<:STMFEXT:>

File extension corresponding to the format being output (e.g. ‘.PDF’ when PDF being generated or ‘.XLS’ when an Excel file is being created.

<:TOFMT:>

To-format. The format of the data being generated (corresponding to the TOFMT parameter of the CVTSPLSTMF command), .e.g. ‘*PDF’, ‘*XLS’

<:SPLDATE:>

The date the spooled file was created (opened) in the format of the current job (DATFMT attribute).

<:SPLDATE*xxx:>

The date the spooled file was created (opened) in the format indicated by *xxx, where *xxx is any one of: *YMD, *MDY, *DMY, *YYMD, *MDYY, *DMYY, *CYMD, *CMDY, *CDMY, *ISO, *EUR, *JIS, *JUL, *LONGJUL, *JOB or *SYSVAL.

<:SPLDAY:>

The day the spooled file was created (opened) as a number 01-31.

<:SPLMONTH:>

The month the spooled file was created (opened) as a number 01-12.

<:SPLYEAR:>

The year the spooled file was created (opened) as a number 0001-9999

<:SPLYEAR4:>

The year the spooled file was created (opened) as a number 0001-9999

<:SPLYEAR3:>

The year the spooled file was created (opened) as a number c01-c99 where c is 0 for the 20th century and 1 for the 21st.

<:SPLYEAR2:>

The year the spooled file was created (opened) as a number 01-99.

<:SPLTIME:>

The time the spooled file was created (opened) in hhmmss format.

<:SPLUSRDTA:>

The user data attribute of the spooled file.

<:SPLUSRDFNDTA:>

The user-defined data attribute of the spooled file.

<:OWNUSER:>

The user profile that owns the spooled file.

<:SPLUSEREMAIL:>

The email address of the spooled file user (user part of spooled file job details). The email address is the SMTP email address of the user from the system directory.

<:SPLUSERNAME:>

The name of the spooled file user (user part of spooled file job details). The name is derived from the information held for the user in the system directory.

<:SPLUSERHOME:>

The home directory of the spooled file user (user part of spooled file job details). The home directory is taken from the HOMEDIR attribute of the user profile.

<:SPLOUTQ:>

Spooled file output queue

<:SPLOUTQLIB:>

Spooled file output queue library

<:CURUSEREMAIL:>

The email address of current user. The email address is the SMTP email address of the user from the system directory.

<:CURUSERNAME:>

The name of the current user. The name is derived from the information held for the user in the system directory.

<:CURUSERHOME:>

The home directory of the current user. The home directory is taken from the HOMEDIR attribute of the user profile.

<:OWNUSEREMAIL:>

The email address of the user profile that owns the spooled file. The email address is the SMTP email address of the user from the system directory.

<:OWNUSERNAME:>

The name of the user profile that owns the spooled file. The name is derived from the information held for the user in the system directory.

<:OWNUSERHOME:>

The home directory of the user profile that owns the spooled file. The home directory is taken from the HOMEDIR attribute of the user profile.

Example:
CVTSPLPDF FROMFILE(QSYSPRT)                
               TOSTMF(‘<:fromfile:>_<:spljob:>_<:spluser:>_<:spljobnbr:>_<:splnbr:>.pdf’)

Here the CVTSPLPDF command is being applied to a spooled file called QSYSPRT. The name of the stream file to be generated will be derived from various spooled file attributes to give a unique name such as:

QSYSPRT_INVOICES_QSYSOPR_123456_2.pdf
Example:
CVTSPLPDF FROMFILE(QSYSPRT)
               EXITPGM(*VAR)
               EXITPGMPRM(*POS)
               EXITPGMPOS((1 7 10 40))
               EMAIL(*YES)
               EMAILTO((‘<:exitpgmpos1:>’))

Here the CVTSPLPDF command is being applied to another spooled file called QSYSPRT. No exit programs are to be called, but exit program parameters are defined for the purposes of using them as variables (EXITPGM(*VAR)). The text item on page 1, line 7, column 10 for 40 characters is extracted and used as the email address to which the spooled file should be sent.

Example:
CVTSPLPDFFROMFILE(QSYSPRT)
               EXITPGM(*VAR)
               EXITPGMPRM(*POS)
               EXITPGMPOS((1 7 10 40 email_address))
               EMAIL(*YES)
               EMAILTO((‘<:email_address:>’))

This example is exactly the same as the previous one, except that the item of data extracted from the spooled file using the EXITPGMPOS parameter is given the name "email_address" and can then be referenced using this name on the EMAILTO parameter.