SeanHoppe.com › CLEO Examples › Communications Script Substitution Variables
Control/Communications Script Substitution Variables
The CMDEXC function has been enhanced to allow for continuation lines (total command string length after substitution parameters may be up to 992 characters) and for a flag which will cause any error in executing a command to be ignored.
The control script functions WRTLINE (write a line as if received) and CMDEXC (execute a command using the QCMDEXC function) each use the 120-character “script text” field to represent a string of textual data. The following discussion refers equally to either function.
If the “script factor 1” contains the word “CONTINUE”, successive script lines are appended to each other until a line where factor 1 does not contain “CONTINUE” is found. Each line is appended at a length equal to the number in “factor 1 parm 1” of each line; if this number is zero, the actual length up to the last non-blank character is used on each appended line.
Once the complete concatenated string has been assembled, it is scanned for all occurrences of any of the substitution variables listed below. The prefix “@” used below is the default value; any other character which does not otherwise appear in the data may be used in place of “@” by specifying it as the first character of “script factor 2” in the last line of a continued group. Different sets of continued lines in the same script may use different substitution prefixes.
Note that the substitution variables have a replacement length which is in general different than the length (always = 3) of the symbolic variable @xx. The numeric variables are always replaced by a fixed number of digits as listed below; the character variables have trailing blanks suppressed after each substitution is made. The resulting concatenated string with replacements made is treated as being of the length specified in “factor 1 parm 2” of the last continued line; if this number is zero, the actual length up to the last non-blank character is used as the output length. The maximum total string length of a group of continued lines is 992 characters.
Substitution variables may be used in the script text string as follows:Variable Value Valid values or range @C1 Century as 0=19, 1=20 0-1 @CC Century as CC 19-20 @YY Year as YY 00 99 @MM Month as MM 01 12 @DD Day as DD 01 31 @YD Date as YYMMDD 000101 991231 @DY Date as DDMMYY 010100 311299 @MY Date as MMDDYY 010100 123199 @CD Date as CCYYMMDD 19400101 20391231 @JJ "Julian" day of year DDD 001 365 @YJ Date as YYDDD 00001 99365 @CJ Date as CCYYDDD 1940001 2039365 @HH Hour as HH 00 23 @MI Minute as MM 00 59 @SS Second as SS 00 59 @HS Time as HHMMSS 000000 235959 @TR Total records 00000000 99999999 @DR Data records 000000 999999 @ER Envelope records 000000 999999 @JB Job name char 10 @JU Job user profile char 10 @JN Job number 000000 999999 @CL Connection log number 0000000 9999999 @CS Control script code char 10 @NW Network ID char 15 @NP Network port char 6 Network port attributes: @NZ Port description char 25 @NT Telephone number char 14 @NN Connection nbr (dial cmd) char 25 @NL Line description char 10 @NC Controller description char 10 @ND Device description char 10 @NM Communications type char 1 @NX Connection type char 1 @NR Max record length 00000 99999 @NB Max block length 00000 99999
The date and time used for substitution purposes are initialized as equal to the "start of call" of the current log of connection record; they may be reset to the current system clock value during script processing with the script function SETTIME.
The record counters (@TR, @DR, @ER) are initialized at zero; the script function RESET may be used to simultaneously reset them all to zero at any point in script processing. Since the communications and import programs (STRCTLSCRR and CVTWRPR respectively) do not actually interpret the content of data records, the “envelope records” counter does not represent actual EDI standard envelope segments. "Envelope records" is incremented whenever a WRTLIN script statement is executed. "Data records" means records written to the wrapped data file. "Total records" is slightly different in import vs. actual communications: when used in the communications program STRCTLSCRR, it means the sum of actual communications records sent and received; for import, it means "envelope records" + "data records" since there is no true equivalent to communications records.
@P1 Script parameter 1 char 1-30 @P2 Script parameter 2 char 1-30 @P3 Script parameter 3 char 1-30 @P4 Script parameter 4 char 1-30 @P5 Script parameter 5 char 1-30 @P6 Script parameter 6 char 1-30 @P7 Script parameter 7 char 1-30 @P8 Script parameter 8 char 1-30 @P9 Script parameter 9 char 1-30
By: Sean Hoppe on