ACI Utility
ACI Utility
Version Record
Nov-2006, Version 10.1
Table Of Contents
Section 1 ................................................................................................................ 1-1
Introduction ........................................................................................................ 1-1
ACI Utilities Overview ....................................................................................... 1-1
Utility Procs File Description.......................................................................... 1-2
Procedures for Using Utilities ........................................................................... 1-3
Syntax Conventions ......................................................................................... 1-5
Section 2 ................................................................................................................ 2-1
Arithmetic Overflow Prevention ....................................................................... 2-1
ADD^DOUBLE.............................................................................................. 2-1
ADD^DOUBLEX (extended address version) ............................................... 2-2
ADD^FIXED .................................................................................................. 2-3
ADD^FIXEDX (extended address version) ................................................... 2-4
ADD^INT....................................................................................................... 2-5
ADD^INTX (extended address version) ........................................................ 2-6
MULT^DOUBLE............................................................................................ 2-7
MULT^DOUBLEX (extended address version) ............................................. 2-8
MULT^FIXED................................................................................................ 2-9
MULT^FIXEDX (extended address version) ............................................... 2-10
MULT^INT................................................................................................... 2-11
MULT^INTX (extended address version) .................................................... 2-12
Section 3 ................................................................................................................ 3-1
Bit Manipulation ................................................................................................. 3-1
CLEARBIT .................................................................................................... 3-1
CLEAR^BITX (extended address version).................................................... 3-2
SETBIT ......................................................................................................... 3-3
SET^BITX (extended address version)......................................................... 3-4
TESTBIT ....................................................................................................... 3-5
TEST^BITX (extended address version)....................................................... 3-6
Section 4 ................................................................................................................ 4-1
Circular Linked List Procs ................................................................................ 4-1
Overview....................................................................................................... 4-1
CL^DELETE.................................................................................................. 4-2
CL^INSERT .................................................................................................. 4-3
Section 5 ................................................................................................................ 5-1
COBOL Processing............................................................................................ 5-1
COBOL^ALTERPRIORITY ........................................................................... 5-1
COBOL^CREATE ......................................................................................... 5-2
COBOL^DELAY............................................................................................ 5-4
COBOL^GETCRTPID................................................................................... 5-5
Nov-2006
ACI Worldwide Inc.
iii
Table Of Contents
COBOL^GETFILENUM................................................................................. 5-6
COBOL^LOOKUPPPD ................................................................................. 5-7
COBOL^PURGE ........................................................................................... 5-8
COBOL^RENAME ........................................................................................ 5-9
Section 6................................................................................................................. 6-1
Date and Time Conversions.............................................................................. 6-1
ASCII^JULIAN^TIMESTAMP ........................................................................ 6-1
ASCII^TIMESTAMP ...................................................................................... 6-2
BUMP^DAY .................................................................................................. 6-3
BUMP^YYMMDD .......................................................................................... 6-4
CLOCK^TIME ............................................................................................... 6-5
COMPARE^ASCII^YYMMDD ....................................................................... 6-6
COMPARE^BINARY^YYMMDD ................................................................... 6-8
CONTIMESTAMP ....................................................................................... 6-10
CONVERT^JULIAN^TO^GREG.................................................................. 6-11
CONVERT^TIME^TO^YYMMDD ................................................................ 6-12
CONVERT^TIMESTAMP^FORMAT ........................................................... 6-13
CONVERT^YYMMDD^TO^TIME ................................................................ 6-14
CURRENT^TIME^AS^STRING................................................................... 6-15
DAY^OF^WEEK.......................................................................................... 6-16
GET^DAY^OF^WEEK................................................................................. 6-17
GET^NEXT^DAY ........................................................................................ 6-18
JULIAN ....................................................................................................... 6-19
JULIAN^DATE ............................................................................................ 6-20
JULIAN^TIMESTAMP^ASCII ...................................................................... 6-21
JULIAN^TO^YYMMDD ............................................................................... 6-22
LEAP^YEAR ............................................................................................... 6-23
LONG^DATE^AND^TIME ........................................................................... 6-24
TEST^HOLIDAY ......................................................................................... 6-25
TEST^WEEKEND ....................................................................................... 6-26
TIMESTAMP^ADJUST^NUM^MINUTES.................................................... 6-27
TIMESTAMP^ADJUST^NUM^MINUTES^DBL ........................................... 6-28
TIMESTAMP^ASCII .................................................................................... 6-29
TIME^ASCII ................................................................................................ 6-30
TIME^TIMESTAMP..................................................................................... 6-32
TIME^ZONE^CHANGE............................................................................... 6-33
TIME^ZONE^CHANGEX (extended address version) ............................... 6-35
TODAYS^DATE .......................................................................................... 6-37
VALID^DAT^TIM^STRING.......................................................................... 6-38
VALID^DATE^YYMMDD............................................................................. 6-40
VALID^TIM^STRING .................................................................................. 6-41
YYMMDD^TO^JULIAN ............................................................................... 6-43
YY^DDD^TO^TIME..................................................................................... 6-44
iv
Nov-2006
ACI Worldwide Inc.
Table Of Contents
Section 7 ................................................................................................................ 7-1
Debugging Procs ............................................................................................... 7-1
HEX^DUMP .................................................................................................. 7-1
PEP^OFFSET............................................................................................... 7-2
TRACER ....................................................................................................... 7-3
TRACER printout example:........................................................................... 7-5
TRACK.......................................................................................................... 7-6
Section 8 ................................................................................................................ 8-1
Encryption/Decryption Procs............................................................................ 8-1
DECODE ...................................................................................................... 8-1
DECODEX (extended address version)........................................................ 8-3
DECRYPT..................................................................................................... 8-5
DECRYPT^PIN ............................................................................................. 8-6
DECRYPT^PIN^1 ......................................................................................... 8-7
ENCODE ...................................................................................................... 8-8
ENCODEX (extended address version)...................................................... 8-10
ENCRYPT................................................................................................... 8-12
PROCESS^DES^PIN.................................................................................. 8-13
Section 9 ................................................................................................................ 9-1
Format Conversion Procs ................................................................................. 9-1
ALL^ASCII^DOUBLE .................................................................................... 9-1
ALL^ASCII^FIXED ........................................................................................ 9-2
ALL^ASCII^INTEGER................................................................................... 9-3
ALL^HEX ...................................................................................................... 9-4
ALL^NUMERIC ............................................................................................. 9-5
ALL^NUMERICX (extended address version) ............................................. 9-6
ASCII^DOUBLE ............................................................................................ 9-7
ASCII^DOUBLEX (extended address version) ............................................ 9-8
ASCII^FIXED ................................................................................................ 9-9
ASCII^FIXEDX (extended address version) ............................................... 9-10
ASCII^INTEGER......................................................................................... 9-11
ASCII^INTEGERX (extended address version) .......................................... 9-12
ASCII^TO^D2230 ....................................................................................... 9-13
ASCII^TO^EBCDIC..................................................................................... 9-14
ASCII^TO^EBCDICX (extended address version) ...................................... 9-15
ASTERISK^FILL ......................................................................................... 9-16
BASE64^DECODE ..................................................................................... 9-17
BASE64^ENCODE ..................................................................................... 9-18
BASE94^DECODE ..................................................................................... 9-19
BASE94^ENCODE ..................................................................................... 9-20
BINARY^HEXCHAR ................................................................................... 9-21
BINARY^HEXCHARX (extended address version)..................................... 9-22
CRNCY^DECIMAL^PLACES...................................................................... 9-23
GET^CNTRY^DATA................................................................................ 9-24
GET^CRNCY^CDE^ALPHA.................................................................... 9-25
CRNCY^DECIMAL^PLACES^ALPHA..................................................... 9-26
Nov-2006
ACI Worldwide Inc.
Table Of Contents
DOLLAR^SUPPRESS ................................................................................ 9-27
DOUBLE^ASCII .......................................................................................... 9-28
DOUBLE^ASCIIX (extended address version) ........................................... 9-29
DOUBLE^DOLLAR ..................................................................................... 9-30
DOUBLE^DOLLAR^ASTERISK.................................................................. 9-32
EBCDIC^TO^ASCII..................................................................................... 9-34
EBCDIC^TO^ASCIIX (extended address version) ...................................... 9-35
FIXED^ASCII .............................................................................................. 9-36
FIXED^ASCIIX (extended address version)................................................ 9-37
FIXED^DOLLAR ......................................................................................... 9-38
FIXED^DOLLAR^ASTERISK ...................................................................... 9-39
FNUMIN ...................................................................................................... 9-40
FNUMOUT .................................................................................................. 9-41
FORMATTED^FNUMOUT .......................................................................... 9-43
GRAPHIC^HEX........................................................................................... 9-45
HEXCHAR^BINARY ................................................................................... 9-46
HEXCHAR^BINARYX (extended address version)..................................... 9-48
HEXCHAR^INTEGER................................................................................. 9-50
INTEGER^ASCII ......................................................................................... 9-51
INTEGER^ASCIIX (extended address version) .......................................... 9-52
INTEGER^HEXCHAR................................................................................. 9-53
SET^PARITY .............................................................................................. 9-54
TRANSLATE............................................................................................... 9-55
TRANSLATEX (extended address version) ................................................ 9-56
ZDNUMIN ................................................................................................... 9-57
ZDNUMOUT ............................................................................................... 9-58
ZNUMOUT .................................................................................................. 9-59
Section 10............................................................................................................. 10-1
Manipulation..................................................................................................... 10-1
String Manipulation......................................................................................... 10-1
CONVERT^FIELD^JUSTIFICATION .......................................................... 10-1
CONVERT^STATE^CODE ......................................................................... 10-2
DELETE^EXTRA^BLANKS......................................................................... 10-3
FIELD^FINDER........................................................................................... 10-4
FIND^STRING ............................................................................................ 10-6
FORMAT^DECIMAL ................................................................................... 10-8
LEFT^JUSTIFY ......................................................................................... 10-10
MOD10^ADD ............................................................................................ 10-11
MOD10^ADDX (extended address version).............................................. 10-12
MOD10^SUBTRACT................................................................................. 10-13
MOD10^SUBTRACTX (extended address version) .................................. 10-14
PACK ........................................................................................................ 10-15
REMOVE^BLANKS................................................................................... 10-17
REMOVE^NON^NUMERIC ...................................................................... 10-18
RIGHT^JUSTIFY....................................................................................... 10-19
STRLEN.................................................................................................... 10-20
vi
Nov-2006
ACI Worldwide Inc.
Table Of Contents
STRLENX (extended address version) .................................................... 10-21
SYM^NAME^LEN ..................................................................................... 10-22
UNPACK................................................................................................... 10-23
VALID^DECIMAL^NUMBER..................................................................... 10-25
ZERO^SUPPRESS................................................................................... 10-26
Data Manipulation ........................................................................................ 10-27
DEFINEs................................................................................................... 10-28
UPSHIFT^FIELD....................................................................................... 10-30
Section 11............................................................................................................. 11-1
Timer Routines................................................................................................. 11-1
Overview..................................................................................................... 11-1
User Data Segment Timer Routines ........................................................... 11-2
DELETE^THIS^TIMER ............................................................................... 11-5
FIND^SPECIFIC^TIMER ............................................................................ 11-6
NEXT^EXPIRE^TIME ................................................................................. 11-7
TIMER^DELETE ......................................................................................... 11-8
TIMER^DELETE^1 ..................................................................................... 11-9
TIMER^EXPIRED ..................................................................................... 11-11
TIMER^INIT .............................................................................................. 11-12
TIMER^INSERT........................................................................................ 11-13
Extended Memory Segment Timer Routines ............................................ 11-14
DELETE^THIS^TIMERX........................................................................... 11-17
FIND^SPECIFIC^TIMERX ........................................................................ 11-18
NEXT^EXPIRE^TIMEX............................................................................. 11-19
TIMER^ALLOCATEX................................................................................ 11-20
TIMER^DELETEX..................................................................................... 11-21
TIMER^EXPIREDX................................................................................... 11-23
TIMER^INITX............................................................................................ 11-24
TIMER^INSERTX ..................................................................................... 11-26
Section 12............................................................................................................. 12-1
Miscellaneous Procs ....................................................................................... 12-1
BINARY^SEARCH...................................................................................... 12-1
CIRC^LEFT^SHIFT..................................................................................... 12-3
CIRC^RIGHT^SHIFT .................................................................................. 12-4
COMPLEMENT .......................................................................................... 12-5
CONVERT^REC^ADDR^TO^REF^NO....................................................... 12-6
CONVERT^REF^NO^TO^REC^ADDR....................................................... 12-7
CURRENT^ADDR ...................................................................................... 12-8
DBL^OCTAL^WIDTH.................................................................................. 12-9
DBL^WIDTH ............................................................................................. 12-10
EDITLINENO ............................................................................................ 12-11
FUNCTION^KEY ...................................................................................... 12-12
GET^NEXT^ARG...................................................................................... 12-13
MOTHER .................................................................................................. 12-15
MSG^AGE ................................................................................................ 12-16
OCTAL^WIDTH ........................................................................................ 12-17
Nov-2006
ACI Worldwide Inc.
vii
Table Of Contents
RANDOM .................................................................................................. 12-18
SHA1^HASH ............................................................................................. 12-19
TRACK^LEN ............................................................................................. 12-20
UT^FNAMECOLLAPSE ............................................................................ 12-21
WIDTH ...................................................................................................... 12-22
viii
Nov-2006
ACI Worldwide Inc.
Section 1
Introduction
ACI Utilities Overview
The ACI Utilities are a collection of utility PROCs distributed on the ACIUTILS
subvolume. These utilities are considered release independent of ACI products.
The utilities are contained in a BINDable object file, and are distributed only in object
file form. Contained on the same subvolume are ACI Utilities external files and C
language prototype files, documentation files, as well as the Supercrypt Utility files.
The utility PROCs are described in this document. For information on the Supercrypt
Utility files see the BASE24 Transaction Security Manual. The contents of this
subvolume are briefly described below:
CLUTILE
C Language externals Large model.
CWUTILE
C Language externals Wide model.
D30UTILB
NSK D30 version of UTILB.
KEYUTIL
Supercrypt Library.
KEYUTILE
External file for KEYUTIL
SKCRYPT
Supercrypt Tool.
SYSMSGS
TAL source code with STRUCTs for system messages.
UTILB
ACI Utility Library, NSK C30 version by default.
UTILDEFS
ACI Utility Library DEFINEs and STRUCTs.
UTILEXTS
External declarations for ACI Utility Library.
UTILHIST
History of changes to ACI Utility Library Source File.
UTILUPDT
Documentation detailing changes to ACIUTILS subvolume
contents.
This manual contains a section giving examples of how to use Compaqs NSK BIND
program to BIND in the utilities you require.
It is important to note that many of the procedures in this manual remain for
backward compatibility. Before using procedures in ACI Utilities for new
development, it is important to do some research. It may be that better alternatives
have been developed in an ACI Product specific utility library (i.e. BASE Utilities or
ATM Utilities), or that Compaq has introduced a comparable procedure into the NSK
run time library.
Nov-2006
ACI Worldwide Inc.
1-1
Introduction
Utility Procs File Description
CWUTILE
2.
D30UTILB
3.
KEYUTIL
4.
KEYUTILE
5.
SKCRYPT
Supercrypt Tool.
6.
SYSMSGS
7.
UTILB
8.
UTILDEFS
9.
UTILEXTS
10.
UTILHIST
11.
UTILUPDT
1-2
Nov-2006
ACI Worldwide Inc.
Introduction
Procedures for Using Utilities
add
add
add
add
define
define
define
define
=aciutils_utilexts,
=aciutils_cwutile,
=aciutils_utilb,
=aciutils_utildefs,
file
file
file
file
$<vol>.ACIUTILS.UTILEXTS
$<vol>.ACIUTILS.CWUTILE
$<vol>.ACIUTILS.UTILB
$<vol>.ACIUTILS.UTILDEFS
Following is an example of how to use NSK BIND. For more information on the
different commands and their parameters, see Compaqs Binder Manual.
Example:
Following is a description of how to BIND in the library utilities ASCII^INTEGER,
ADD^DOUBLE, and WIDTH. These utilities were only chosen as an example.
These procedures will work for any of the utilities.
To compile the source program that refers to any of the library utilities, the
external declaration for each utility needed must be SOURCEd in. For this
example you would need:
?source =ACIUTILS_UTILEXTS (
?
ASCII^INTEGER,
?
ADD^DOUBLE,
?
WIDTH )
Nov-2006
ACI Worldwide Inc.
1-3
Introduction
Procedures for Using Utilities
Note: The carrot character (^) is changed to an underscore character (_) in C.
The prototypes are specified in both all upper and all lower case. Since C
is case sensitive both options are provided. The NOLIST directive is
optional.
The next step is to create an edit file (BIND can be run interactively, but an edit
file allows you to reuse the commands without having to type them in each time).
This file should contain the following information:
ADD * FROM <yourfile>
SELECT SEARCH =ACIUTILS_UTILB
BUILD newfile!
c
d
e
c Selects all PROCs, global code and global data from your object file.
d Instructs BIND to resolve unresolved externals with code sections from =ACIUTILS_UTILB.
e Creates a new object program file "newfile" containing the object code from "yourfile" and the
utilities.
Note: C Language equivalents are not available for data structures and defines in
the ACI Utilities Sources.
You will also need to SOURCE in the following EXTERNAL declarations:
?source =ACIUTILS_UTILEXTS( TIMER^INIT,
?
NEXT^EXPIRE^TIME,
?
TIMER^DELETE,
?
TIMER^INSERT,
?
TIMER^EXPIRED,
?
FIND^SPECIFIC^TIMER )
To create the edit file containing the BIND commands, the same procedures can be
used as described in the preceding example.
1-4
Nov-2006
ACI Worldwide Inc.
Introduction
Syntax Conventions
Syntax Conventions
The following is a summary of the characters and symbols used in the syntax
notation for the utility procedures in this manual. The syntax standards follow those
used by Tandem.
NOTATION
MEANING
UPPER-CASE
CHARACTERS
<lower-case
characters>
All variable entries supplied by the user are shown in lowercase characters and enclosed in angle brackets. If the entry
is required, it is underlined; otherwise, it is optional.
Punctuation
System
Procedure Calls
Nov-2006
ACI Worldwide Inc.
1-5
Introduction
Syntax Conventions
NOTATION
MEANING
<type> is INT, INT(32), STRING, or FIXED [ ( <fpoint> ) ]
A function procedure can be called with a CALL statement,
but the return value will be lost.
<parameters> are described as follows:
<parameter>,<type>:ref:<num elements>
or
value
<type> is INT, INT(32), STRING or FIXED [ ( <fpoint> ) ]
ref indicates a reference parameter.
<num elements> indicates that the procedure returns a value
of <type> to <parameter> for <num elements>.
value indicates a value parameter.
1-6
Nov-2006
ACI Worldwide Inc.
Section 2
Arithmetic Overflow Prevention
These routines are designed to prevent arithmetic overflow traps. There are routines
for both addition and multiplication, on INT, DOUBLE, and FIXED variables.
ADD^DOUBLE
This routine was designed to prevent arithmetic overflow traps when adding several
double-word variables. The routine returns the result of the operation in <result> if an
overflow does not occur. If over-flow occurs, the PROC returns FALSE in <stat>.
Syntax:
<stat> := ADD^DOUBLE( <result> , <val1> , <val2> ,<val3> , . . . <val8> )
where:
<stat>, INT,
<result>, INT(32):ref,
<val1>...<val8>, INT(32):ref,
example:
stat := ADD^DOUBLE( result, val1, val2, val3, val4 )
Nov-2006
ACI Worldwide Inc.
2-1
<resultx>, INT(32):ref,
<val1>...<val8>, INT(32):ref,
example:
stat := ADD^DOUBLEX( resultx, val1, val2, val3, val4 )
2-2
Nov-2006
ACI Worldwide Inc.
ADD^FIXED
This routine was designed to prevent arithmetic overflow traps when adding several
FIXED (64 bit) variables. The routine returns the result of the operation in <result> if
an overflow does not occur. If overflow occurs, the PROC returns FALSE in <stat>.
The user is responsible for decimal alignment.
Syntax:
<stat> := ADD^FIXED( <result>, <val1>, <val2> , <val3>, . . .<val8> )
where:
<stat>, INT,
<result>, FIXED:ref,
<val1>...<val8>, FIXED:ref,
example:
stat := ADD^FIXED( result, val1, val2, val3, val4 )
Nov-2006
ACI Worldwide Inc.
2-3
<resultx>, FIXED:ref,
<val1>...<val6>, FIXED:ref,
example:
stat := ADD^FIXEDX( resultx, val1, val2, val3, val4 )
2-4
Nov-2006
ACI Worldwide Inc.
ADD^INT
This routine was designed to prevent arithmetic overflow traps when adding several
INT variables. The routine returns the result of the operation in <result> if an
overflow does not occur. If overflow occurs, the PROC returns FALSE.
Syntax:
<stat> := ADD^INT( <result> , <val1> , <val2> , <val3> ,<val4> , ... <val8> )
where:
<stat>, INT,
<result>, INT:ref,
<val1>...<val8>, INT:ref,
example:
stat := ADD^INT( result, val1, val2, val3, val4 )
Nov-2006
ACI Worldwide Inc.
2-5
<resultx>, INT:ref,
<val1>...<val8>, INT:ref,
example:
stat := ADD^INTX( resultx, val1, val2, val3, val4 )
2-6
Nov-2006
ACI Worldwide Inc.
MULT^DOUBLE
This routine was designed to prevent arithmetic overflow traps when multiplying
several double-word variables. The routine returns the result of the operation in
<result> if an overflow does not occur. If overflow occurs, the PROC returns FALSE.
Syntax:
<stat> := MULT^DOUBLE( <result> , <val1> , <val2>, <val3>, . . . <val8> )
where:
<stat>, INT,
<result>, INT(32):ref,
<val1>...<val8>, INT(32):ref,
example:
stat := MULT^DOUBLE( result, val1, val2, val3 )
Nov-2006
ACI Worldwide Inc.
2-7
<resultx>, INT(32):ref,
<val1>...<val8>, INT(32):ref,
example:
stat := MULT^DOUBLEX( resultx, val1, val2, val3 )
2-8
Nov-2006
ACI Worldwide Inc.
MULT^FIXED
This routine was designed to prevent arithmetic overflow traps when multiplying
several FIXED (64 bit) variables. The routine returns the result of the operation in
<result> if an overflow does not occur. If overflow occurs, the PROC returns FALSE.
The user is responsible for decimal alignment.
Syntax:
<stat> := MULT^FIXED( <result>, <val1>, <val2>, <val3>, . . . <val8> )
where:
<stat>, INT,
<result>, FIXED(*):ref,
Nov-2006
ACI Worldwide Inc.
2-9
<resultx>, FIXED(*):ref,
2-10
Nov-2006
ACI Worldwide Inc.
MULT^INT
This routine was designed to prevent arithmetic overflow traps when multiplying
several INT variables. The routine returns the result of the operation in <result> if an
overflow does not occur. If overflow occurs, the PROC returns FALSE.
Syntax:
<stat> := MULT^INT( <result>, <val1>, <val2>, <val3> . . . <val8> )
where:
<stat>, INT,
<result>, INT:ref,
<val1>...<val8>, INT:ref,
example:
stat := MULT^INT( result, val1, val2, val3, val4 )
Nov-2006
ACI Worldwide Inc.
2-11
<resultx>, INT:ref,
<val1>...<val8>, INT:ref,
example:
stat := MULT^INTX( resultx, val1, val2, val3, val4 )
2-12
Nov-2006
ACI Worldwide Inc.
Section 3
Bit Manipulation
CLEARBIT
Clears a bit of a vector.
Syntax:
CALL CLEARBIT( <array> , <bit> )
where:
<array>, INT:ref,
<bit>, INT,
example:
INT
bit^array[ 0:19 ],
bit;
bit := 25;
CALL CLEARBIT( bit^array, bit );
NOTE:
It is up to the user to insure that the value of <bit> lies in the defined
range; this PROC has no knowledge of the declared length of <array>.
Nov-2006
ACI Worldwide Inc.
3-1
Bit Manipulation
CLEAR^BITX (extended address version)
<bit>, INT,
example:
INT
bit := 25;
CALL CLEAR^BITX( bit^arrayx, bit );
NOTE:
3-2
It is up to the user to insure that the value of <bit> lies in the defined
range; this PROC has no knowledge of the declared length of <array>.
Nov-2006
ACI Worldwide Inc.
Bit Manipulation
SETBIT
SETBIT
Sets a bit of a vector.
Syntax:
CALL SETBIT( <array> , <bit> )
where:
<array>, INT:ref,
<bit>, INT,
example:
INT
bit^array[ 0:19 ],
bit;
bit := 25;
CALL SETBIT( bit^array, bit );
NOTE:
It is up to the user to insure that the value of <bit> lies in the defined
range; this PROC has no knowledge of the declared length of <array>.
Nov-2006
ACI Worldwide Inc.
3-3
Bit Manipulation
SET^BITX (extended address version)
<bit>, INT,
example:
INT
bit := 25;
CALL SET^BITX( bit^arrayx, bit );
NOTE:
3-4
It is up to the user to insure that the value of <bit> lies in the defined
range; this PROC has no knowledge of the declared length of <array>.
Nov-2006
ACI Worldwide Inc.
Bit Manipulation
TESTBIT
TESTBIT
Returns a TRUE/FALSE value as determined by the state of the bit in question of a
bit vector.
Syntax:
<stat> := TESTBIT( <array> , <bit> )
where:
<stat>, INT,
<array>, INT:ref,
<bit>, INT,
example:
INT
bit^array[ 0:19 ],
bit;
bit := 25;
IF TESTBIT( bit^array, bit ) THEN
... !bit on
ELSE
... !bit off
NOTE:
It is up to the user to insure that the value of <bit> lies in the defined
range; this PROC has no knowledge of the declared length of <array>.
Nov-2006
ACI Worldwide Inc.
3-5
Bit Manipulation
TEST^BITX (extended address version)
<arrayx>, INT:ref,
<bit>, INT,
example:
INT
bit := 25;
IF TEST^BITX( bit^arrayx, bit ) THEN
... !bit on
ELSE
... !bit off
NOTE:
3-6
It is up to the user to insure that the value of <bit> lies in the defined
range; this PROC has no knowledge of the declared length of <array>.
Nov-2006
ACI Worldwide Inc.
Section 4
Circular Linked List Procs
Overview
An item in a circular linked list contains data coupled with pointers to the previous
and next items in the list.
POINTER TO
PREV
POINTER TO
NEXT
When several of these items are combined, they may form a circular linked list similar
to the following:
@A
@E
@D
@B
ITEM 1
@C
@B
@E
ITEM 4
@A
@E
@C
ITEM 2
@D
@C
@A
ITEM 5
@B
@D
ITEM 3
At the beginning of the linked list is an entry whose pointer to the previous item
contains the address of the last item in the list. Its pointer to the next item contains
the address of the item following it in the list. The next item pointer of the beginning
entry in the linked list will point to the beginning entry itself if there are no entries in
the circular linked list.
These two PROCs take care of the previous and next pointer linkages. The
programmer must provide the definition of the linked list and the data to be kept in it
(usually timers).
Nov-2006
ACI Worldwide Inc.
4-1
CL^DELETE
Deletes an item from a circular linked list by adjusting the appropriate linkages.
Syntax:
<stat> := CL^DELETE( <item> )
where:
<stat>, INT,
<item>, INT,
example:
STRUCT
BEGIN
INT
INT
STRING
END;
INT
.list^item[ 0:max ];
prev^item;
nxt^item;
item^contents[ 0:contents^max ];
cur;
cur := 6;
stat := CL^DELETE( @list^item[ cur ] );
4-2
Nov-2006
ACI Worldwide Inc.
CL^INSERT
Adds an item to a circular linked list by adjusting the appropriate linkages. No data is
entered into the list.
Syntax:
<stat> := CL^INSERT( <item> , <new^item> )
where:
<stat>, INT,
<item>, INT,
<new^item>, INT,
example:
STRUCT
BEGIN
INT
INT
STRING
END;
INT
.list^item[ 0:max ];
prev^item;
nxt^item;
item^contents [ 0:contents^max ];
end^of^list,
avail;
end^of^list := 75;
avail
:= 3;
IF CL^INSERT( @list^item[ end^of^list ],
@list^item [ avail ] )
THEN
... !valid linkage
ELSE
... !error condition
Nov-2006
ACI Worldwide Inc.
4-3
4-4
Nov-2006
ACI Worldwide Inc.
Section 5
COBOL Processing
These utilities were written to aid the COBOL programmer in file management when
writing COBOL programs.
COBOL^ALTERPRIORITY
Used to change the priority of a process.
Syntax:
<stat> := COBOL^ALTERPRIORITY( <pid>, <priority> )
where:
<stat>, INT,
<pid>, INT:ref:4,
<priority>, INT,
NOTE:
example:
01
01
01
STAT
PID
PRIORITY
PIC 99.
PIC 9999
PIC 99
COMP.
COMP
VALUE 100.
Nov-2006
ACI Worldwide Inc.
5-1
COBOL Processing
COBOL^CREATE
COBOL^CREATE
Creates a file. (See the CREATE Procedure in the Guardian Operating System
Programming manual for a complete description of the parameters).
Syntax:
<stat> := COBOL^CREATE (<fname>, <pri-extent-size>,
<file-cde>, <secndry-extent-size>,
<file-typ>, <rec-lgth>,
<data-blk-lgth>, <keyseq-param>,
<altkey-param>, <part-param> )
where:
<stat>, INT,
<fname>, INT:ref:12,
<pri-extent-size>, INT,
<file-cde>, INT,
<secndry-extent-size>, INT,
<file-typ>, INT,
<rec-lgth>, INT,
<data-blk-lgth>, INT,
5-2
Nov-2006
ACI Worldwide Inc.
COBOL Processing
COBOL^CREATE
<altkey-param>, STRING:ref
<part-param>, STRING:ref
NOTE:
example:
01 STAT
01 COMMAND-FILE.
02 FNAME.
03 VOL
03 SVOL
03 NAM
02 PRI-EXT
02 FILE-CDE
02 SECNDRY-EXT
02 FILE-TYP
02 REC-LGTH
02 BLK-LGTH
PIC 99
COMP.
PIC X(8)
PIC X(8)
PIC X(8)
PIC S9(4)
PIC S9(4)
PIC S9(4)
PIC S9(4)
PIC S9(4)
PIC S9(4)
VALUE "$DATA1".
VALUE "PROJ ".
VALUE "TEST ".
COMP
VALUE 10.
COMP
VALUE 25.
COMP
VALUE 6.
COMP
VALUE 0.
COMP
VALUE 130.
COMP
VALUE 4096.
Nov-2006
ACI Worldwide Inc.
5-3
COBOL Processing
COBOL^DELAY
COBOL^DELAY
Puts the COBOL program into a delay that does not use up CPU time.
Syntax:
CALL COBOL^DELAY( <amt> )
where:
<amt>, INT(32),
NOTE:
example:
01
AMT
PIC 9999
COMP
VALUE 300.
5-4
Nov-2006
ACI Worldwide Inc.
COBOL Processing
COBOL^GETCRTPID
COBOL^GETCRTPID
Returns the PID of the calling COBOL program.
Syntax:
<stat> := COBOL^GETCRTPID( <pid> )
where:
<stat>, INT,
<pid>, INT:ref,
NOTE:
example:
01
01
STAT
PID
PIC 99
PIC 99.
COMP.
Nov-2006
ACI Worldwide Inc.
5-5
COBOL Processing
COBOL^GETFILENUM
COBOL^GETFILENUM
Returns the file number and/or an error given the file name as input. File must have
been opened once before passing it to this procedure.
Syntax:
<stat> := COBOL^GETFILENUM( <file-ptr>, <fnum> )
where:
<stat>, INT,
<file-ptr>, STRING:ref:24,
<fnum>, INT:ref,
NOTE:
example:
01 MY-FNAME.
02 VOL
02 SVOL
02 NAME
01 FNUM
01 STAT
PIC X(8)
PIC X(8)
PIC X(8)
PIC 99 COMP.
PIC 99 COMP.
5-6
Nov-2006
ACI Worldwide Inc.
COBOL Processing
COBOL^LOOKUPPPD
COBOL^LOOKUPPPD
Checks for a PPD entry associated with the input process name.
Syntax:
<stat> := COBOL^LOOKUPPPD( <input-pro-nam> )
where:
<stat>, INT,
<input-pro-nam>, STRING:ref:18,
NOTE:
example:
01 STAT
01 INPUT-PRO-NAM
PIC 99.
PIC X(18)
VALUE "\SYSTEM.$PPD1
".
Nov-2006
ACI Worldwide Inc.
5-7
COBOL Processing
COBOL^PURGE
COBOL^PURGE
Used to delete a disk file.
Syntax:
<stat> := COBOL^PURGE( <fname> )
where:
<stat>, INT,
<fname>, STRING:ref
NOTE:
example:
01 MY-FNAME.
02 VOL
02 SVOL
02 NAME
01 STAT
PIC X(8)
PIC X(8)
PIC X(8)
PIC 99
5-8
Nov-2006
ACI Worldwide Inc.
COBOL Processing
COBOL^RENAME
COBOL^RENAME
Used to change the name of a disk file.
Syntax:
<stat> := COBOL^RENAME( <old^fname>, <new^fname> )
where:
<stat>, INT,
<old^fname>, STRING:ref:24,
<new^fname>, STRING:ref:24,
NOTE:
example:
01 OLD-FNAME.
02 VOL
02 SVOL
02 NAM
PIC X(8)
PIC X(8)
PIC X(8)
01 NEW-FNAME.
02 VOL
PIC X(8)
02 SVOL
PIC X(8)
02 NAM
PIC X(8)
01 STAT
PIC 99
Nov-2006
ACI Worldwide Inc.
5-9
COBOL Processing
COBOL^RENAME
5-10
Nov-2006
ACI Worldwide Inc.
Section 6
Date and Time Conversions
The majority of the date and time conversion PROCs detailed on the following pages
contain no input validation routines. Consequently, an invalid timearray or timestamp
input will yield unpredictable results. These are standard Tandem timestamps and
timearrays as described in the TIME and TIMESTAMP procedures in the Guardian
Procedure Calls Reference Manual.
ASCII^JULIAN^TIMESTAMP
Converts a date in YYYYMMDD format and a time in HHMMSSMMMMMM format to
a Julian timestamp.
Syntax:
<stat> := ASCII^JULIAN^TIMESTAMP( <ascii^dat> , <ascii^tim> , <julian^ts> )
where:
<stat>, INT,
<ascii^dat>, STRING:ref:8,
<ascii^tim>, STRING:ref:12,
<julian^ts>, FIXED(0):ref,
example:
FIXED
STRING
julian^ts;
.ascii^dat[ 0:7 ],
.ascii^tim[ 0:11 ];
6-1
ASCII^TIMESTAMP
Converts a string YYMMDDHHMMSSHH to a 48 bit timestamp form.
Syntax:
<stat> := ASCII^TIMESTAMP( <yymmddhhmmsshh> , <lgth> , <ts^array> )
where:
<stat>, INT,
<yymmddhhmmsshh>, STRING:ref,
<lgth>, INT:val,
<ts^array>, INT:ref:3,
example:
INT
STRING
ts[ 0:2 ];
.ascii^ts[ 0:13 ];
6-2
Nov-2006
ACI Worldwide Inc.
BUMP^DAY
Receives a time array (as set up by the call to "TIME") increments that date by one
day and returns a binary value of the new date.
Syntax:
CALL BUMP^DAY( <timarray> , <new^dd^bin> , yyyymmdd^bin );
where:
<timarray>, INT:ref,
<new^dd^bin>, INT(32):ref,
<yyyymmdd^bin>, INT(32):ref,
example:
INT
INT(32)
.timarray[ 0:6 ];
new^dd^bin,
yyyymmdd^bin;
Nov-2006
ACI Worldwide Inc.
6-3
BUMP^YYMMDD
Adds a specified number of days to an ASCII YYMMDD date string.
Syntax:
CALL BUMP^YYMMDD( <yymmdd> , <num^days> );
where:
<yymmdd>, STRING:ref,
<num^days>, INT,
example:
STRING
INT
.yymmdd[ 0:5 ];
num^days;
6-4
Nov-2006
ACI Worldwide Inc.
CLOCK^TIME
Returns a character string containing the time in the form HH:MM:SS AM or
HH:MM:SS PM.
Syntax:
CALL CLOCK^TIME( <ptr> );
where:
<ptr>, STRING:ref:11,
example:
STRING
.hold^formatted^tim[ 0:10 ];
Nov-2006
ACI Worldwide Inc.
6-5
COMPARE^ASCII^YYMMDD
This utility compares, according to the supplied operator, two 6-byte string dates in
YYMMDD format. Prior to comparison, the 6-byte dates are expanded from
YYMMDD to YYYYMMDD format, allowing comparisons between dates in the 20th
and 21st centuries. If a supplied date's 2- digit year YY falls in the range 00-74, the
date is expanded to 20YYMMDD. If a supplied date's 2-digit year YY falls in the
range 75- 99, the date is expanded to 19YYMMDD. NOTE: If either supplied date is
all spaces, zeroes or binary zeroes, it is expanded to eight bytes of spaces, zeroes or
binary zeroes.
Syntax:
<stat> := COMPARE^ASCII^YYMMDD( <yymmdd^1> , <operator> , <yymmdd^2> )
where:
<stat>, INT,
<yymmdd^1>, STRING:ref:6,
<operator>, INT:value,
Value
1
2
3
4
5
6
7
8
Operator
<
>
<=
>=
'<'
'>'
'<='
'>='
<yymmdd^2>, STRING:ref:6,
6-6
Description
signed less than
signed greater than
signed less than or equal to
signed greater than or equal to
unsigned less than
unsigned greater than
unsigned less than or equal to
unsigned greater than or equal to
Nov-2006
ACI Worldwide Inc.
.yymmdd^1[ 0:5 ],
.yymmdd^2[ 0:5 ];
Nov-2006
ACI Worldwide Inc.
6-7
COMPARE^BINARY^YYMMDD
This utility compares, according to the supplied operator, two binary dates in
YYMMDD format. Prior to comparison, the binary dates are expanded from
YYMMDD to YYYYMMDD format, allowing comparisons between dates in the 20th
and 21st centuries. If a supplied date's 2-digit year YY falls in the range 00-74, the
date is expanded to 20YYMMDD. If a supplied date's 2-digit year YY falls in the
range 75-99, the date is expanded to 19YYMMDD. NOTE: If either supplied date is
zero, it remains zero for the comparison.
Syntax:
<stat> := COMPARE^BINARY^YYMMDD( <dat^1> , <operator> , <dat^2> )
where:
<stat>, INT,
<dat^1>, INT(32):value,
<operator>, INT:value,
Value
1
2
3
4
<dat^2>, INT(32):value,
6-8
Operator
<
>
<=
>=
Description
signed less than
signed greater than
signed less than or equal to
signed greater than or equal to
Nov-2006
ACI Worldwide Inc.
dat^1,
dat^2;
dat^1 := 991231d;
dat^2 := 000101d;
IF COMPARE^BINARY^YYMMDD( dat^1, 3 !<=!, dat^2 ) THEN
BEGIN
! 991231 occurs before (is less than) 000101.
! Perform appropriate processing.
END;
Nov-2006
ACI Worldwide Inc.
6-9
CONTIMESTAMP
Converts the seven word version of time to 48 bit timestamp. The conversion makes
it possible to compare the current time to a time and date recorded in timestamp
form.
Syntax:
CALL CONTIMESTAMP( <tim^array> , <ts^array> );
where:
<tim^array>, INT:ref:7,
NOTE:
The time format is an integer array in which each word from 0-6
contains, respectively, the year, month, day, hour, minute, second and
hundredths of second.
<ts^array>, INT:ref:3,
NOTE:
example:
INT
6-10
Nov-2006
ACI Worldwide Inc.
CONVERT^JULIAN^TO^GREG
Constructs the month, day, and year of a date given the true Julian day number of
that date. The true Julian day number is defined as the number of days since 1
January 4713 B.C.
Syntax:
CALL CONVERT^JULIAN^TO^GREG( <jdn>, <yyyy>, <mm>, <dd> );
where:
<jdn>, INT(32),
<yyyy>, INT:ref,
<mm>, INT:ref,
<dd>, INT:ref,
example:
INT(32)
INT
jdn;
yyyy,
mm,
dd;
jdn := 2451900d;
CALL CONVERT^JULIAN^TO^GREG( jdn, yyyy, mm, dd );
Nov-2006
ACI Worldwide Inc.
6-11
CONVERT^TIME^TO^YYMMDD
Accepts a timearray and returns year, month and day in binary form.
Syntax:
CALL CONVERT^TIME^TO^YYMMDD( <tim^array> , <dbl^yymmdd> ,
<dbl^yyyymmdd> );
where:
<tim^array>, INT:ref:7,
<dbl^yymmdd>, INT(32):ref,
<dbl^yyyymmdd>, INT(32):ref,
example:
INT
.timarray[ 0:6 ] := [
INT (32)
dbl^yymmdd,
dbl^yyyymmdd;
6-12
Nov-2006
ACI Worldwide Inc.
CONVERT^TIMESTAMP^FORMAT
Will convert between Tandem's 48 bit timestamp and the new fixed Julian timestamp
format in Greenwich Mean Time.
Syntax:
<stat> := CONVERT^TIMESTAMP^FORMAT( <ts> , <julian> , <direction> )
where:
<stat>, INT,
<direction>, INT,
example:
INT
FIXED
.timestamp [0:2],
direction,
stat;
.julian;
direction
stat
:= 1;
:= CONVERT^TIMESTAMP^FORMAT( timestamp,
julian, direction );
direction
stat
:= 0;
:= CONVERT^TIMESTAMP^FORMAT( timestamp,
julian, direction );
Nov-2006
ACI Worldwide Inc.
6-13
CONVERT^YYMMDD^TO^TIME
Accepts year, month and day in binary form, and returns a Tandem standard
timearray.
Syntax:
CALL CONVERT^YYMMDD^TO^TIME( <dbl^yymmdd> , <tim^array> );
where:
<dbl^yymmdd>, INT(32),
<tim^array>, INT:ref:7,
example:
INT
INT (32)
.timarray[ 0:6 ];
dblyymmdd;
6-14
Nov-2006
ACI Worldwide Inc.
CURRENT^TIME^AS^STRING
Returns the current time as YYMMDDHHMMSSSS in string form. Each field
contains two digits. Will only return the bytes requested.
Syntax:
CALL CURRENT^TIME^AS^STRING( <str> , <lgth> );
where:
<str>, STRING:ref,
<lgth>, INT,
example:
STRING
INT
.str[ 0:5 ];
lgth;
lgth := 6;
CALL CURRENT^TIME^AS^STRING( str, lgth );
If the current date and time is "2000101512000000" then, str will contain
"001015" after the call.
Nov-2006
ACI Worldwide Inc.
6-15
DAY^OF^WEEK
Returns the day of the week given a Julian day number. The value returned is a
number from 1 to 7. 1 is for Sunday...7 is for Saturday.
Syntax:
<dd> := DAY^OF^WEEK( <julian^dd^num> )
where:
<dd>, INT,
<julian^dd^num>, INT(32):ref,
example:
INT
INT(32)
dd;
julian^dd^num;
julian^dd^num := 2451900d;
dd
:= DAY^OF^WEEK( julian^dd^num );
6-16
Nov-2006
ACI Worldwide Inc.
GET^DAY^OF^WEEK
Accepts a timearray and returns the day of the week for that date. Returns 1 for
Monday, 2 for Tuesday, etc.
Syntax:
CALL GET^DAY^OF^WEEK( <tim^array> , <dd> );
where:
<tim^array>, INT:ref:7,
<dd>, INT:ref,
example:
INT
.timarray[ 0:6 ],
dd;
Nov-2006
ACI Worldwide Inc.
6-17
GET^NEXT^DAY
Receives a time array as set up by a call to "TIME" and returns the same time array
modified to contain the next day.
Syntax:
CALL GET^NEXT^DAY( <timarray> );
where:
<timarray>, INT, ref:7,
example:
INT
.timarray[ 0:6 ];
6-18
Nov-2006
ACI Worldwide Inc.
JULIAN
Returns the true Julian day number of the date represented by the input parameter.
The true Julian day number is defined as the number of days since 1 January 4713
B.C.
Syntax:
<julian^dd^num> := JULIAN( <yyyy>, <mm>, <dd> )
where:
<julian^dd^num>, INT(32),
<yyyy>, INT,
<mm>, INT,
<dd>, INT,
example:
INT
INT(32)
yyyy,
mm,
dd;
julian^dd^num;
yyyy := 2000;
mm := 10;
dd
:= 15;
julian^dd^num := JULIAN( yyyy, mm, dd );
Nov-2006
ACI Worldwide Inc.
6-19
JULIAN^DATE
Returns a 6 byte field containing the julian date at the time this proc is called in the
form YYYJJJ.
Syntax:
<stat> := JULIAN^DATE( <jul^dat> )
where:
<stat>, INT,
<jul^dat>, STRING:ref,
example:
STRING
INT
jul^dat[ 0:5 ];
stat;
6-20
Nov-2006
ACI Worldwide Inc.
JULIAN^TIMESTAMP^ASCII
Converts a Julian timestamp to a date in YYYYMMDD format and a time in
HHMMSSMMMMMM format.
Syntax:
<stat> := JULIAN^TIMESTAMP^ASCII( <ascii^dat> , <ascii^tim> ,<julian^ts> )
where:
<stat>, INT,
<ascii^dat>, STRING:ref:8,
<ascii^tim>, STRING:ref:12,
<julian^ts>, FIXED(0):value,
example:
FIXED
STRING
julian^ts;
.ascii^dat[ 0:7 ],
.ascii^tim[ 0:11 ];
Nov-2006
ACI Worldwide Inc.
6-21
JULIAN^TO^YYMMDD
Converts a true Julian day to a date in YYMMDD format. The true Julian day number
is defined as the number of days since 1 January 4713 B.C.
Syntax:
CALL JULIAN^TO^YYMMDD( <julian^dd> , <yymmdd> );
where:
<julian^dd>, INT(32):val,
<yymmdd>, STRING:ref,
example:
INT32)
STRING
julian^dd;
ascii^dat[ 0:5 ];
julian^dd := 2113758d;
CALL JULIAN^TO^YYMMDD( julian^dd, ascii^dat );
6-22
Nov-2006
ACI Worldwide Inc.
LEAP^YEAR
Returns TRUE if the year supplied is a leap-year. Defaults to the current year if none
is supplied. If the year supplied is 2 digits (less than 100) the following assumptions
are made: If the 2 digit year is in the range 00-74, assume the century is 2000. If the
2 digit year is in the range 75-99, assume the century is 1900.
Syntax:
<stat> := LEAP^YEAR( <yy> )
where:
<stat>, INT,
<yy>, INT,
example:
INT
yy
stat
yy
stat
stat
Nov-2006
ACI Worldwide Inc.
yy;
:= 1999
:= LEAP^YEAR( yy );
:= 99;
:= LEAP^YEAR( yy );
:= LEAP^YEAR;
6-23
LONG^DATE^AND^TIME
Returns the current date and time as a readable character string in the following
format:
" Sunday, October 15, 2000 - 12:00:00 PM "
The length of the string is returned in a second parameter. The maximum string
length is 44 characters.
Syntax:
CALL LONG^DATE^AND^TIME( <str> , <str^lgth> );
where:
<str>, STRING:ref:44,
<str^lgth>, INT:ref,
example:
STRING
INT
.dat^char^str[ 0:43 ];
str^lgth;
6-24
Nov-2006
ACI Worldwide Inc.
TEST^HOLIDAY
Returns TRUE in a supplied parameter if the given date is one of the following:
New Year's day
(January 1)
Independence day
(July 4)
California Admission day
(September 9)
Christmas
(December 25)
Washington's Birthday
(3rd Monday in February)
Memorial day
(Last Monday in May)
Labor day
(First Monday in September)
Thanksgiving
(4th Thursday in November)
Syntax:
CALL TEST^HOLIDAY( <tim^array> , <hol> );
where:
<tim^array>, INT:ref:7,
<hol>, INT:ref
example:
INT
.timarray[ 0:6 ],
hol;
Nov-2006
ACI Worldwide Inc.
6-25
TEST^WEEKEND
Accepts a timearray and returns TRUE in a supplied parameter if the day of the week
of the array is Saturday or Sunday.
Syntax:
CALL TEST^WEEKEND( <tim^array> , <wknd> );
where:
<tim^array>, INT:ref:7,
<wknd>, INT:ref,
example:
INT
.timarray[ 0:6 ],
wknd;
6-26
Nov-2006
ACI Worldwide Inc.
TIMESTAMP^ADJUST^NUM^MINUTES
Adds number of minutes to a given array.
Syntax:
CALL TIMESTAMP^ADJUST^NUM^MINUTES( <ts^array^1> ,
<num^minutes>, <ts^array^2> );
where:
<ts^array^1>, INT, ref:3,
<num^minutes>, INT,
example:
INT
.ts^array^1[ 0:2 ],
.ts^array^2[ 0:2 ],
num^minutes;
num^minutes := 5;
CALL TIMESTAMP( ts^array^1 );
CALL TIMESTAMP^ADJUST^NUM^MINUTES( ts^array^1,
num^minutes,
ts^array^2 );
Nov-2006
ACI Worldwide Inc.
6-27
TIMESTAMP^ADJUST^NUM^MINUTES^DBL
Adds number of minutes to a given array. Similar to
TIMESTAMP^ADJUST^NUM^MINUTES except that it accepts an INT(32) value for
the number of minutes parameter.
Syntax:
CALL TIMESTAMP^ADJUST^NUM^MINUTES^DBL( <ts^array^1> ,
<num^minutes>, <ts^array^2> );
where:
<ts^array^1>, INT, .EXT:ref:3,
<num^minutes>, INT(32),
example:
INT
.ts^array^1[ 0:2 ],
.ts^array^2[ 0:2 ];
INT(32) num^minutes;
num^minutes := 70000D;
CALL TIMESTAMP( ts^array^1 );
CALL TIMESTAMP^ADJUST^NUM^MINUTES( ts^array^1,
num^minutes,
ts^array^2 );
6-28
Nov-2006
ACI Worldwide Inc.
TIMESTAMP^ASCII
Converts a timestamp array to the ASCII representation.
Syntax:
CALL TIMESTAMP^ASCII( <yymmddhhmmsshh> , <lgth> , <ts^array> );
where:
<yymmddhhmmsshh>, STRING:ref,
<lgth>, INT:val,
<ts^array>, INT:ref:3,
example:
INT
STRING
.ts[ 0:2 ];
.ascii^ts[ 0:11 ]; ! omit hundredth
! of seconds
CALL TIMESTAMP( ts );
CALL TIMESTAMP^ASCII( ascii^ts, 12, ts );
Nov-2006
ACI Worldwide Inc.
6-29
TIME^ASCII
Returns the ASCII representation of either or both of date and time in the form
YYMMDDHHMMSSHH or just the date in the form MMDDYY. The date/time to be
converted to ASCII may be provided in the call to the proc as either a 7 word integer
time array or a 3 word timestamp. If neither argument is passed, the time is
acquired via a call to the NSK 'TIME' procedure. If both arguments are passed, only
the 7 word time array is used.
Syntax:
CALL TIME^ASCII( <yymmddhhmmsshh> , <mmddyy> , <lgth>
,<user^tim^array> , <ts>);
where:
<yymmddhhmmsshh>, STRING:ref,
<mmddyy>, STRING:ref,
NOTE:
6-30
<lgth>, INT:val,
<user^tim^array>, INT:ref:7,
Nov-2006
ACI Worldwide Inc.
example:
INT
STRING
Nov-2006
ACI Worldwide Inc.
6-31
TIME^TIMESTAMP
Converts a timearray into a Tandem 48 bit Timestamp form. This is the opposite of
Tandem's NSK proc CONTIME.
Syntax:
CALL TIME^TIMESTAMP( <timarray>, <ts> );
where:
<timarray>, INT:ref:7,
<ts>, INT:ref:3,
example:
INT
.timarray[ 0:6 ],
.ts[ 0:2 ];
6-32
Nov-2006
ACI Worldwide Inc.
TIME^ZONE^CHANGE
Will add or subtract a number of minutes to compensate for a different time zone.
Minutes are passed as INT, either positive or negative. This proc converts the string
data into a timestamp and calls 'TIMESTAMP^ADJUST^NUM^MINUTES'. The
timestamp returned by this proc is reconverted into ASCII. The ASCII string is
picked apart to get the year, month, day, hour, and minutes as separate strings. The
calling proc can then rearrange the data as needed. Midnight is 00 hours, therefore
hh^s is 00 and mm^s is 00. One minute past midnight is 00 for hh^s and 01 for
mm^s.
Syntax:
<stat> := TIME^ZONE^CHANGE( <yymmdd^s> , <hhmm^s> ,
<minutes> , <yy^s> ,
<mo^s> , <dd^s> , <hh^s> ,
<mm^s> , <err> )
where:
<stat>, INT,
<yymmdd^s>, STRING:ref,
<hhmm^s>, STRING:ref,
<minutes>, INT,
<yy^s>, STRING:ref,
<mo^s>, STRING:ref,
<dd^s>, STRING:ref,
<hh^s>, STRING:ref,
Nov-2006
ACI Worldwide Inc.
6-33
<err>, INT:ref,
example:
STRING
INT
yymmdd^s[ 0:5 ],
hhmm^s[ 0:3 ],
yy^s[ 0:1 ],
mo^s[ 0:1 ],
dd^s[ 0:1 ],
hh^s[ 0:1 ],
mm^s[ 0:1 ];
minutes,
err,
stat;
yymmdd^s := 991231;
hhmm^s
:= 1430;
minutes
:= 60;
stat := TIME^ZONE^CHANGE( yymmdd^s, hhmm^s, minutes,
yy^s, mo^s, dd^s, hh^s,
mm^s, err );
6-34
Nov-2006
ACI Worldwide Inc.
<yymmdd^s>, STRING:ref,
<hhmm^s>, STRING:ref,
<minutes>, INT,
<yy^s>, STRING:ref,
<mo^s>, STRING:ref,
<dd^s>, STRING:ref,
<hh^s>, STRING:ref,
<mm^s>, STRING:ref,
Nov-2006
ACI Worldwide Inc.
6-35
example:
STRING
INT
.ext
.ext
.ext
.ext
.ext
.ext
.ext
.ext
yymmdd^s,[0:5],
hhmm^s,[0:3],
yy^s, [0:1],
mo^s, [0:1],
dd^s, [0:1],
hh^s, [0:1],
mm^s; [0:1];
err,
minutes,
stat;
yymmdd^s := 991231;
hhmm^s
:= 1430;
minutes
:= 60;
stat := TIME^ZONE^CHANGEX( yymmdd^s, hhmm^s,
minutes, yy^s, mo^s, dd^s,
hh^s, mm^s, err );
6-36
Nov-2006
ACI Worldwide Inc.
TODAYS^DATE
Returns today's date in one or both of the following forms:
1) 10/15/2000
2) October 15, 2000
A value may be passed to the PROC to indicate the length of the string to return.
Syntax:
CALL TODAYS^DATE( <short^form>, <long^form>, <lgth> );
where:
<short^form>, STRING:ref:8,
<long^form>, STRING:ref:18,
<lgth>, INT:ref,
example:
INT
STRING
lgth
.short^form[ 0:7 ],
.long^form[ 0:17 ];
Nov-2006
ACI Worldwide Inc.
6-37
VALID^DAT^TIM^STRING
Checks for a valid date and time string. Returns false for any invalid date or time
component or non-string data.
Syntax:
<stat> := VALID^DAT^TIM^STRING( <dat^tim> , <dat^tim^lgth> ,
<four^digit^year> , <error> )
where:
6-38
<stat>, INT,
Nov-2006
ACI Worldwide Inc.
0 no error
1 YY was bad (first two digit os a 4 digit year)
2 YY was bad (two digit year or last two digits of a 4 digit year)
3 MM was bad (month digits)
4 DD was bad
5 HH was bad
6 MM was bad (minute digits)
7 SS was bad
8 1 tenth of a second was bad
9 1 hundredth of a second was bad
10 1 thousandth of a second was bad
11 10 thousandth of a second was bad
12 100 thousandth of a second was bad
13 1 millionth of a second was bad
-1 if missing a required parameter or if a parameter was invalid
example:
LITERAL
STRING
INT
true = -1,
false = 0;
.dat^tim[ 0:19 ];
error,
stat;
Nov-2006
ACI Worldwide Inc.
6-39
VALID^DATE^YYMMDD
Checks for a valid date. Returns false for any non-valid date or nonstring data.
Syntax:
<stat> := VALID^DATE^YYMMDD( <yymmdd> , <err> )
where:
<stat>, INT,
example:
STRING
INT
.yymmdd[ 0:5 ];
err,
stat;
6-40
Nov-2006
ACI Worldwide Inc.
VALID^TIM^STRING
Checks for a valid time string. Returns false for any invalid time component or nonstring data.
Syntax:
<stat> := VALID^TIM^STRING( <tim> , <tim^lgth> , <error> )
where:
<stat>, INT,
0
1
2
3
4
5
6
7
8
9
-1
Nov-2006
ACI Worldwide Inc.
no error
HH was bad
MM was bad
SS was bad
1 tenth of a second was bad
1 hundredth of a second was bad
1 thousandth of a second was bad
10 thousandth of a second was bad
100 thousandth of a second was bad
1 millionth of a second was bad
if missing a required parameter or if a parameter was invalid
6-41
.tim[ 0:11 ];
error,
stat;
tim ':=' "123000000001";
stat := VALID^TIM^STRING( tim, 12, error );
6-42
Nov-2006
ACI Worldwide Inc.
YYMMDD^TO^JULIAN
Converts a date in YYMMDD format to a true Julian day. The true Julian day number
is defined as the number of days since 1 January 4713 B.C.
Syntax:
julian^dd := YYMMDD^TO^JULIAN( <yymmdd> )
where:
<julian^dd>, INT(32),
<yymmdd>, STRING:ref,
example:
STRING
INT(32)
dat[ 0:5 ];
julian^dd;
dat
julian^dd
':=' "001015";
:= yymmdd^to^julian( dat );
Nov-2006
ACI Worldwide Inc.
6-43
YY^DDD^TO^TIME
Converts a 2 digit year and a 3 digit day count from Jan. 1 of the year to a timearray.
Syntax:
CALL YY^DDD^TO^TIME( <yy> , <ddd> , <tim^array> );
where:
<yy>, INT:ref,
<ddd>, INT:ref,
<tim^array>, INT:ref:7,
example:
INT
INT
yy,
ddd;
.timarray[ 0:6 ];
yy
:= 1990;
ddd
:= 86;
CALL YY^DDD^TO^TIME( yy, ddd, timarray );
Note: If YY is less than 75 it is assumed to be 20YY otherwise it is assumed to be
19YY.
6-44
Nov-2006
ACI Worldwide Inc.
Section 7
Debugging Procs
These utilities are additional debugging tools that can be used along with Tandem's
debugging facility DEBUG. Information on how to use DEBUG can be found in
Tandem's "DEBUG Reference Manual".
HEX^DUMP
Converts to hexadecimal representation any block of data storage beginning with an
address specified as a variable name. The number of an open file is passed for the
hexadecimal data to be written to.
Syntax:
CALL HEX^DUMP( <dump^file>, <tag> , <where> , <lgth> )
where:
<dump^file>, INT,
<tag>, INT(32),
<where>, STRING:ref,
<lgth>, INT,
example:
INT
INT(32)
STRING
dump^file,
buf^lgth;
src^tag;
.data^buf[ 0:1999 ];
buf^lgth
:= 25;
src^tag
:= 909d;
CALL HEX^DUMP( dump^file, src^tag, data^buf, buf^lgth );
Nov-2006
ACI Worldwide Inc.
7-1
Debugging Procs
PEP^OFFSET
PEP^OFFSET
Accepts an input address and returns in a character string the procedure name that
contains that input address. If present, the object file name entered in <obj^nam> is
searched; otherwise, it searches the calling program. If an error occurs during the
search, the file error number is returned; otherwise, it returns FALSE (0).
Syntax:
<stat> := PEP^OFFSET( <procedure^addr>, <str>, <lgth>, <obj^nam> )
where:
<stat>, INT,
<procedure^addr>, INT,
<str>, STRING:ref:86
....+....1....+....2....+....3....+....4....+....5....+.
ADDR %012345 = INIT^MSG + %000236 for $SYSTEM.AN.OBJECT
<obj^nam>, INT:ref:12,
example:
INT
STRING
procedure^addr,
.obj^nam[ 0:11 ] := ["$system an
lgth,
file^err;
.return^str[ 0:85 ];
object "],
procedure^addr := %012345;
file^err
:= PEP^OFFSET( procedure^addr, return^str, lgth,
obj^nam );
7-2
Nov-2006
ACI Worldwide Inc.
Debugging Procs
TRACER
TRACER
May be used to dump to an appropriate dump file global or local data in formats to be
determined by the user. All formats include an ASCII dump printed to the right of the
hexadecimal or octal dump (see examples on the following page). The volume of
data to be written in any given call to the proc is limited only by NSK.
Syntax:
CALL TRACER( <dump^file>, <tlabel> , <where> , <lgth> , <typ>, <xlate> )
where:
<dump^file>, INT,
<tlabel>, INT(32),
<where>, STRING:ref,
<lgth>, INT,
<typ>, INT,
<xlate>, INT,
NOTE:
If the <dump^file> file is not open at the time of the call, TRACER does
an immediate return.
Nov-2006
ACI Worldwide Inc.
7-3
Debugging Procs
TRACER
example:
INT
INT(32)
STRING
dump^file^num,
buf^lgth;
src^tag;
.data^buf[ 0:1999 ];
buf^lgth
:= 25;
src^tag
:= "LABL";
CALL TRACER( dump^file^num, src^tag, data^buf, buf^lgth );
! DEFAULTS TO HEXADECIMAL
7-4
Nov-2006
ACI Worldwide Inc.
Debugging Procs
TRACER printout example:
TST1
00036
00056
00076
00116
00136
00156
00176
00216
TST2
44416
44436
44456
44476
44516
44536
44556
44576
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
................
................
!"#$%&'()*+,-./
0123456789:;<=>?
@ABCDEFGHIJKLMNO
PQRSTUVWXYZ[\]^_
@abcdefghijklmno
pqrstuvwxyz[\]^
*
*
*
*
*
*
*
*
000000
000020
000040
000060
000100
000120
000140
000160
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
................
................
!"#$%&'()*+,-./
0123456789:;<=>?
@ABCDEFGHIJKLMNO
PQRSTUVWXYZ[\]^_
@abcdefghijklmno
pqrstuvwxyz[\]^
*
*
*
*
*
*
*
*
000000
000020
000040
000060
000100
000120
000140
000160
01 SEP 1983
* 120 061 101
* 040 040 000
* 124 123 040
* 124 123 040
* 000 010 000
* 000 000 000
* 000 000 000
* 111 124 123
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
P1A^ITS
....830831S1AI
TS
S1AI
TS
....
.........).<....
................
................
ITS P1A^ITS
*
*
*
*
*
*
*
*
000000
000020
000040
000060
000100
000120
000140
000160
14:15:53.12
136 111 124
000 000 001
040 040 040
040 040 040
037 000 013
000 000 000
000 000 000
040 120 061
0E
1E
2E
3E
4E
5E
6E
7E
123
070
040
040
000
000
000
101
0F
1F
2F
3F
4F
5F
6F
...
...
...
...
...
...
...
...
Nov-2006
ACI Worldwide Inc.
* 000000
* 000020
7-5
Debugging Procs
TRACK
TRACK
Enables a programmer to follow program flow as a procedure executes and to view
the contents of one or two variables at the same time. It also allows a program to
abend or go into DEBUG following its execution.
Syntax:
CALL TRACK( <dump^file>, <tag> , <var1> , <var2> , <base> , <disp> )
where:
7-6
<dump^file>, INT,
<tag>, INT(32),
<base>, INT,
<disp>, INT,
Nov-2006
ACI Worldwide Inc.
Debugging Procs
TRACK
example:
INT
INT(32)
dump^file,
dspy^var1,
dspy^var2,
base,
call^debug;
tag := [ "xfil" ];
base
:= 16;
call^debug := 1;
CALL TRACK( dump^file, tag, dspy^var1, dspy^var2, base,
call^debug );
Nov-2006
ACI Worldwide Inc.
7-7
Debugging Procs
TRACK
7-8
Nov-2006
ACI Worldwide Inc.
Section 8
Encryption/Decryption Procs
These PROCs are based on the federal Data Encryption Standard (DES). DES
specifies an algorithm to be used for the cryptographic protection of computer data.
Encrypting data converts it to an unintelligible form called cipher. Decrypting cipher
converts the data back to its original form. The algorithm specifies both enciphering
and deciphering operations which are based on a binary number called a key. The
key consists of 64 bits of which 56 bits are used directly by the algorithm and 8 bits
are used for error detection. For a more detailed description of this algorithm, you
may refer to the Federal Information Data Encryption Standard.
DECODE
Provides a software implementation of the DES. DECODE accepts text and a key,
and returns decoded text.
Syntax:
CALL DECODE( <txt> , <key> , <wrk> );
where:
<txt>, INT:ref:4,
<key>, INT:ref:4,
<wrk>, INT:ref:52,
example:
INT
.txt[ 0:3 ],
.key[ 0:3 ],
.wrk[ 0:51 ];
TXT :=[%hd5d4,%h4ff7,%h2068,%h3d0d];
KEY :=[%H0123,%H4567,%H89AB,%HCDEF];
CALL DECODE( txt, key, wrk );
Nov-2006
ACI Worldwide Inc.
8-1
Encryption/Decryption Procs
DECODE
The DES encryption routines build an intermediate transposition table in the allocated
"work" space. The table is created from the key by extensive bit transposition and
substitution routines. Each time ENCODE or DECODE is called, the procs test to
determine if the "work" table has been created. If the table isn't present, one is
created. The table building step takes the majority of the CPU time required for this
routine. For the sake of efficiency, the work area avoids the need to rebuild the
tables when using the same key over. Rebuilding the table should be avoided if at all
possible.
Therefore, you should try to associate the "work" area with the key so that the first
time the key is used, the table is built. Each subsequent time the key is used, the
same table should be used. Notice that, in general, this requires that work areas
need to be in global space or within a storage area associated with a record. An
example would be to include the work space within a TDF record. If the TDF was
usually maintained in extended memory, extra space could be allocated in extended
memory associated with the record. Similarly, since authorization by IBM DES
verification requires a DES encryption step, the work space allocated should be
associated with the IDF that has the PIN verification DES key.
8-2
Nov-2006
ACI Worldwide Inc.
Encryption/Decryption Procs
DECODEX (extended address version)
example:
INT
txt
:=[%hd5d4,%h4ff7,%h2068,%h3d0d];
key :=[%H0123,%H4567,%H89AB,%HCDEF];
CALL DECODEX( txtx, keyx, wrkx );
The DES encryption routines build an intermediate transposition table in the allocated
"work" space. The table is created from the key by extensive bit transposition and
substitution routines. Each time ENCODE or DECODE is called, the procs test to
determine if the "work" table has been created. If the table isn't present, one is
created. The table building step takes the majority of the CPU time required for this
routine. For the sake of efficiency, the work area avoids the need to rebuild the
tables when using the same key over. Rebuilding the table should be avoided if at all
possible.
Therefore, you should try to associate the "work" area with the key so that the first
time the key is used, the table is built. Each subsequent time the key is used, the
same table should be used. Notice that, in general, this requires that work areas
need to be in global space or within a storage area associated with a record. An
example would be to include the work space within a TDF record. If the TDF was
usually maintained in extended memory, extra space could be allocated in extended
Nov-2006
ACI Worldwide Inc.
8-3
Encryption/Decryption Procs
DECODEX (extended address version)
memory associated with the record. Similarly, since authorization by IBM DES
verification requires a DES encryption step, the work space allocated should be
associated with the IDF that has the PIN verification DES key.
8-4
Nov-2006
ACI Worldwide Inc.
Encryption/Decryption Procs
DECRYPT
DECRYPT
Receives a string and "unscrambles" it by means of bit-shifting and complementing.
It is compatible with the ENCRYPT procedure.
Syntax:
<stat> := DECRYPT( <str> , <lgth> )
where:
<stat>, INT,
<lgth>, INT,
example:
INT
INT
STRING
stat;
lgth;
.str[0:7];
lgth
:=8;
str
:=ABCD1234;
stat := DECRYPT( str, lgth );
Nov-2006
ACI Worldwide Inc.
8-5
Encryption/Decryption Procs
DECRYPT^PIN
DECRYPT^PIN
Used to decode encrypted PIN. The encrypted PIN is represented in graphic
characters.
Syntax:
<stat> := DECRYPT^PIN( <e^PIN>, <key>, <d^PIN> )
where:
<stat>, INT,
<e^PIN>, INT:ref:8,
<key>, INT:ref:4,
<d^PIN>, INT:ref:8,
example:
INT
.encrypted^PIN[ 0:7 ],
.key[ 0:3 ],
.decrypted^PIN[ 0:7 ];
encrypted^pin := 2580=0=6;489==1;;
key
:= [%h0123,%h4567,%h89AB,%hCDEF];
IF DECRYPT^PIN( encrypted^PIN, key,
decrypted^PIN ) THEN
... !successful
ELSE
... !error
Note: In graphic characters the hexdigits ABCDEF are represented by ASCII
characters :;<=>? (colon, semi-colon, less-than, equal-sign, greater-than,
and question mark.)
8-6
Nov-2006
ACI Worldwide Inc.
Encryption/Decryption Procs
DECRYPT^PIN^1
DECRYPT^PIN^1
Used to decode an encrypted PIN that has been represented by ASCII characters.
Syntax:
<stat> := DECRYPT^PIN^1( <e^PIN>, <key>, <d^PIN> )
where:
<stat>, INT,
<e^PIN>, INT:ref:8,
<key>, INT:ref:4,
<d^PIN>, INT:ref:8,
Example:
INT
.encrypted^PIN[ 0:7 ],
.key[ 0:3 ],
.decrypted^PIN[ 0:7 ];
encrypted^pin := 2580D0D6B489DD1B;
key
:= [%h0123,%h4567,%h89AB,%hCDEF];
IF DECRYPT^PIN^1( encrypted^PIN, key,
decrypted^PIN ) THEN
... !successful
ELSE
... !error
Nov-2006
ACI Worldwide Inc.
8-7
Encryption/Decryption Procs
ENCODE
ENCODE
Provides a software implementation of the DES. ENCODE accepts text and a key,
and returns encoded text.
Syntax:
CALL ENCODE( <txt> , <key> , <wrk> );
where:
<txt>, INT:ref:4,
<key>, INT:ref:4,
<wrk>, INT:ref:52,
example:
INT
.txt[ 0:3 ],
.key[ 0:3 ],
.wrk[ 0:51 ];
txt := [%h0000,%h0000,%h0000,%h0000];
key := [%h0123,%h4567,%h89AB,%hCDEF];
CALL ENCODE( txt, key, wrk );
The DES encryption routines build an intermediate transposition table in the allocated
"work" space. The table is created from the key by extensive bit transposition and
substitution routines. Each time ENCODE or DECODE is called, the procs test to
determine if the "work" table has been created. If the table isn't present, one is
created. The table building step takes the majority of the CPU time required for this
routine. For the sake of efficiency, the work area avoids the need to rebuild the
tables when using the same key over. Rebuilding the table should be avoided if at all
possible.
Therefore, you should try to associate the "work" area with the key so that the first
time the key is used, the table is built. Each subsequent time the key is used, the
same table should be used. Notice that, in general, this requires that work areas
need to be in global space or within a storage area associated with a record. An
example would be to include the work space within a TDF record. If the TDF was
usually maintained in extended memory, extra space could be allocated in extended
8-8
Nov-2006
ACI Worldwide Inc.
Encryption/Decryption Procs
ENCODE
memory associated with the record. Similarly, since authorization by IBM DES
verification requires a DES encryption step, the work space allocated should be
associated with the IDF that has the PIN verification DES key.
Nov-2006
ACI Worldwide Inc.
8-9
Encryption/Decryption Procs
ENCODEX (extended address version)
example:
INT
txt := [%h0000,%h0000,%h0000,%h0000];
key := [%h0123,%h4567,%h89AB,%hCDEF];
CALL ENCODEX( txtx, keyx, wrkx );
The DES encryption routines build an intermediate transposition table in the allocated
"work" space. The table is created from the key by extensive bit transposition and
substitution routines. Each time ENCODE or DECODE is called, the procs test to
determine if the "work" table has been created. If the table isn't present, one is
created. The table building step takes the majority of the CPU time required for this
routine. For the sake of efficiency, the work area avoids the need to rebuild the
tables when using the same key over. Rebuilding the table should be avoided if at all
possible.
Therefore, you should try to associate the "work" area with the key so that the first
time the key is used, the table is built. Each subsequent time the key is used, the
same table should be used. Notice that, in general, this requires that work areas
need to be in global space or within a storage area associated with a record. An
example would be to include the work space within a TDF record. If the TDF was
usually maintained in extended memory, extra space could be allocated in extended
8-10
Nov-2006
ACI Worldwide Inc.
Encryption/Decryption Procs
ENCODEX (extended address version)
memory associated with the record. Similarly, since authorization by IBM DES
verification requires a DES encryption step, the work space allocated should be
associated with the IDF that has the PIN verification DES key.
Nov-2006
ACI Worldwide Inc.
8-11
Encryption/Decryption Procs
ENCRYPT
ENCRYPT
Receives a string and "scrambles" it by means of bit-shifting and complementing. It
is compatible with the DECRYPT procedure.
Syntax:
<stat> := ENCRYPT( <str> , <lgth> )
where:
<stat>, INT,
<str>, STRING:ref,
<lgth>, INT,
example:
INT
INT
STRING
stat;
lgth;
.str[0:7];
lgth
:=8;
str
:=ABCD1234;
stat := ENCRYPT( str, lgth );
8-12
Nov-2006
ACI Worldwide Inc.
Encryption/Decryption Procs
PROCESS^DES^PIN
PROCESS^DES^PIN
An implementation of the DES-based PIN verification algorithm. It can handle
variable-length PINs, ranging from 1 to 16 digits.
Syntax:
<stat> := PROCESS^DES^PIN( <pin> , <pin^lgth> , <val^data> ,<val^ofst> ,
<val^lgth> , <val^pad> , <encr^key> ,<dec^tab> , <pin^ofst> ,
<ofst^lgth> , <min^pin^lgth> ,<max^pin^lgth> , <process^type ,
<status> , <des^ofst^ind>);
where:
<stat>, INT,
<pin>, STRING:ref,
<pin^lgth>, INT:val,
<val^data>, STRING:ref,
<val^ofst>, INT:val,
<val^lgth>, INT:val,
<val^pad>, STRING:ref,
<encr^key>, INT:ref,
Nov-2006
ACI Worldwide Inc.
8-13
Encryption/Decryption Procs
PROCESS^DES^PIN
8-14
<dec^tab>, STRING:ref,
<pin^ofst>, STRING:ref,
<ofst^lgth>, INT:val,
<min^pin^lgth>, INT:val,
<max^pin^lgth>, INT:val,
<process^type>, INT:val,
<des^ofst^ind>, STRING:val,
value
type of processing
Nov-2006
ACI Worldwide Inc.
Encryption/Decryption Procs
PROCESS^DES^PIN
NOTE: <pin^ofst> and <ofst^lgth> become required
parameters for this <process^type>. Also, the
description of steps 6 and 7 in the following
validation narrative are changed (basically, a
modulo-10 subtract is performed instead of a
modulo-10 addition).
3
<status>, INT:ref,
examples:
INT
INT
INT
INT
INT
INT
INT
INT
INT
INT
.encr^key[0:3];
err;
max^pin^lgth;
min^pin^lgth;
ofst^lgth;
pin^lgth;
stat;
val^lgth;
val^ofst;
verify^pin;
STRING
STRING
STRING
STRING
STRING
.dec^tab[0:15];
.pin[0:15];
.pin^ofst[0:15];
.val^data[0:15];
val^pad;
pin
pin^lgth
val^data
val^ofst
val^lgth
val^pad
encr^key
dec^tab
pin^ofst
Nov-2006
ACI Worldwide Inc.
':=' "0000000000001234";
:= 4;
':=' "4321555566667777";
:= 1;
:= 10;
:= "F";
':=' [%h0123, %h4567, %h89ab, %hcdef];
':=' "0123456789012345";
':=' "9240000000000000";
8-15
Encryption/Decryption Procs
PROCESS^DES^PIN
ofst^lgth
min^pin^lgth
max^pin^lgth
:= 4;
:= 4;
:= 16;
TYPE 1
verify^pin
:= 1;
stat := process^des^pin( pin, pin^lgth, val^data, val^ofst, val^lgth,
val^pad, encr^key, dec^tab, pin^ofst,
ofst^lgth, min^pin^lgth, max^pin^lgth,
verify^pin, err, R !des^ofst^ind!);
TYPE 2
pin^ofst
':=' "****************";
verify^pin
:= 2;
stat := process^des^pin( pin, pin^lgth, val^data, val^ofst, val^lgth,
val^pad, encr^key, dec^tab, pin^ofst,
ofst^lgth, min^pin^lgth, max^pin^lgth,
verify^pin, err );
NOTE: On return, pin^ofst will equal "9240************".
TYPE 3
pin
':=' "****************";
verify^pin
:= 3;
stat := process^des^pin( pin, pin^lgth, val^data, val^ofst, val^lgth,
val^pad, encr^key, dec^tab, pin^ofst,
ofst^lgth, min^pin^lgth, max^pin^lgth,
verify^pin, err );
NOTE: On return, pin will equal "0000000000001234".
8-16
Nov-2006
ACI Worldwide Inc.
Encryption/Decryption Procs
PROCESS^DES^PIN
Nov-2006
ACI Worldwide Inc.
8-17
Encryption/Decryption Procs
PROCESS^DES^PIN
8-18
Nov-2006
ACI Worldwide Inc.
Section 9
Format Conversion Procs
ALL^ASCII^DOUBLE
Converts an ASCII string to an INT(32) value skipping non-numerics. Values can be
negative by placing a "-" sign before the number.
Syntax:
CALL ALL^ASCII^DOUBLE( <txt> , <lgth> , <val> )
where:
<txt>, STRING:ref,
<lgth>, INT,
<val>, INT(32):ref,
example:
STRING
INT
INT(32)
.txt[ 0:4 ];
lgth;
val;
txt
':=' "12345";
lgth := 5;
CALL ALL^ASCII^DOUBLE( txt, lgth, val );
Nov-2006
ACI Worldwide Inc.
9-1
ALL^ASCII^FIXED
Converts an ASCII string to a FIXED value skipping non-numerics. Values can be
negative by placing a "-" sign before the number.
Syntax:
CALL ALL^ASCII^FIXED( <txt> , <lgth> , <val> )
where:
<txt>, STRING:ref,
<lgth>, INT,
<val>, FIXED:ref,
example:
STRING
INT
FIXED
.txt[ 0:4 ];
lgth;
val;
txt
':=' "-1234";
lgth := 5;
CALL ALL^ASCII^FIXED( txt, lgth, val );
9-2
Nov-2006
ACI Worldwide Inc.
ALL^ASCII^INTEGER
Converts a string to an INT value. It first removes all non-numeric characters and
returns a negative value if negative.
Syntax:
CALL ALL^ASCII^INTEGER( <val> , <txt> , <lgth> )
where:
<val>, INT:ref,
<txt>, STRING:ref,
<lgth>, INT,
example:
STRING
INT
INT
.txt[0:4];
lgth;
val;
txt
:= 12345;
lgth
:= 5
CALL ALL^ASCII^INTEGER( val, txt, lgth )
Nov-2006
ACI Worldwide Inc.
9-3
ALL^HEX
Used to check if all characters of the given input string are valid hexadecimal.
Syntax:
<stat> := ALL^HEX( <hex^str> , <lgth> )
where:
<stat>, INT,
<hex^str>, STRING:ref,
<lgth>, INT,
example:
STRING
INT
.txt[ 0:7 ],
lgth;
txt
':=' "01abcdef";
lgth := 8;
IF ALL^HEX( txt , lgth ) THEN
! success
ELSE
! error
9-4
Nov-2006
ACI Worldwide Inc.
ALL^NUMERIC
Checks an ASCII field for all numeric characters. Returns TRUE (-1) if all characters
are numeric.
Syntax:
<stat> := ALL^NUMERIC( <txt> , <lgth> )
where:
<stat>, INT,
<txt>, STRING:ref,
<lgth>, INT,
example:
STRING
INT
.txt[ 0:7 ],
txt^lgth;
txt
':=' "01234567";
txt^lgth
:= 8;
IF ALL^NUMERIC( txt, txt^lgth ) THEN
! all numeric field
ELSE
! error
Nov-2006
ACI Worldwide Inc.
9-5
<txtx>, STRING.EXT:ref,
<lgth>, INT,
example:
STRING
INT
txtx
':=' "01234567";
txt^lgth
:= 8;
IF ALL^NUMERICX( txtx, txt^lgth ) THEN
! all numeric field
ELSE
! error
9-6
Nov-2006
ACI Worldwide Inc.
ASCII^DOUBLE
Converts ASCII to a double-word value. The number to be converted must be
numeric and greater than or equal to zero. The PROC will return TRUE or FALSE to
indicate whether or not the conversion was successful. An overflow condition or a
non-numeric character will result in a return of FALSE.
Syntax:
<stat> := ASCII^DOUBLE( <txt> , <txt^lgth> , <val> )
where:
<stat>, INT,
<txt>, STRING:ref,
<txt^lgth>, INT,
<val>, INT(32):ref,
example:
STRING
INT
INT (32)
.txt[ 0:3 ];
txt^lgth;
val;
txt
':=' "1982"
txt^lgth
:= 4;
IF ASCII^DOUBLE( txt, txt^lgth, val ) THEN
! successful
ELSE
! error
Nov-2006
ACI Worldwide Inc.
9-7
<txtx>, STRING.EXT:ref,
<txt^lgth>, INT,
<valx>, INT(32).EXT:ref,
example:
STRING
INT
INT (32)
txtx
':=' "1982"
txt^lgth
:= 4;
IF ASCII^DOUBLEX( txtx, txt^lgth, valx ) THEN
! successful
ELSE
! error
9-8
Nov-2006
ACI Worldwide Inc.
ASCII^FIXED
Converts ASCII to a FIXED (64 bit) value. The number to be converted must be
numeric and greater than or equal to zero. The PROC will return TRUE or FALSE to
indicate whether or not the conversion was successful. An overflow condition or a
non-numeric character will result in a return of FALSE.
Syntax:
<stat> := ASCII^FIXED( <txt> , <txt^lgth> , <val> )
where:
<stat>, INT,
<txt>, STRING:ref,
<txt^lgth>, INT,
<val>, FIXED(*):ref,
example:
STRING
INT
FIXED
.txt[ 0:9 ];
txt^lgth;
val;
txt
':=' "0123456789";
txt^lgth
:= 10;
IF ASCII^FIXED( txt, txt^lgth, val ) THEN
! successful
ELSE
! error
Nov-2006
ACI Worldwide Inc.
9-9
<txtx>, STRING.EXT:ref,
<txt^lgth>, INT,
<valx>, FIXED(*).EXT:ref,
example:
STRING
INT
FIXED(*)
txtx
':=' "0123456789";
txt^lgth
:= 10;
IF ASCII^FIXEDX( txtx, txt^lgth, valx ) THEN
! successful
ELSE
! error
9-10
Nov-2006
ACI Worldwide Inc.
ASCII^INTEGER
Converts ASCII to an INT value. The number to be converted must be numeric and
greater than or equal to zero. The PROC will return TRUE or FALSE to indicate
whether or not the conversion was successful. An overflow condition or a nonnumeric character will result in a return of FALSE.
Syntax:
<stat> := ASCII^INTEGER( <txt> , <txt^lgth> , <val> )
where:
<stat>, INT,
<txt>, STRING:ref,
<txt^lgth>, INT,
<val>, INT:ref,
example:
STRING
INT
.txt[ 0:1 ];
txt^lgth,
val;
txt
':=' "12";
txt^lgth
:= 2;
IF ASCII^INTEGER( txt, txt^lgth, val ) THEN
! successful
ELSE
! error
Nov-2006
ACI Worldwide Inc.
9-11
<txtx>, STRING.EXT:ref,
<txt^lgth>, INT,
<valx>, INT.EXT:ref,
example:
STRING
INT
txtx
':=' "12";
txt^lgth
:= 2;
IF ASCII^INTEGERX( txtx, txt^lgth, valx ) THEN
! successful
ELSE
! error
9-12
Nov-2006
ACI Worldwide Inc.
ASCII^TO^D2230
Used to translate a string from ASCII character to Dataproducts 2230 line printer
subset.
Syntax:
CALL ASCII^TO^D2230( <src^str> , <lgth> )
where:
<src^str>, STRING:ref,
example:
STRING
INT
.src^str[ 0:19 ];
lgth;
src^str
':=' "translate";
lgth
:= 9;
CALL ASCII^TO^D2230( src^str, lgth );
Nov-2006
ACI Worldwide Inc.
9-13
ASCII^TO^EBCDIC
Used to translate a string from ASCII character to EBCDIC.
Syntax:
CALL ASCII^TO^EBCDIC( <src^str> , <lgth> );
where:
<src^str>, STRING:ref,
<lgth>, INT,
example:
STRING
INT
.src^str[ 0:4 ];
lgth;
src^str
':=' "ASCII";
lgth
:= 5;
CALL ASCII^TO^EBCDIC( src^str, lgth );
9-14
Nov-2006
ACI Worldwide Inc.
<lgth>, INT,
example:
STRING
INT
src^strx
':=' "ASCII";
lgth
:= 5;
CALL ASCII^TO^EBCDICX( src^strx, lgth );
Nov-2006
ACI Worldwide Inc.
9-15
ASTERISK^FILL
Replaces leading zeroes, if any, with asterisks. For example:
input string contains
"000189"
output will be
"***189"
Syntax:
CALL ASTERISK^FILL( <input^str> , <str^lgth> )
where:
<input^str>, STRING:ref
<str^lgth>, INT,
example:
INT
STRING
lgth
input^str[0:5];
input^str := 000189;
lgth
:=6;
CALL ASTERISK^FILL( input^str , lgth )
9-16
Nov-2006
ACI Worldwide Inc.
BASE64^DECODE
This procedure converts base64-encoded data to binary format according to the
standard set forth in RFC 1521, section 5.2 Base64 Content-Transfer-Encoding (N.
Borenstein, 1993). Every four bytes of base64-encoded data become three bytes of
decoded binary data. All non-base64 characters encountered in the input data (e.q
carriage return/line feed) are ignored. However, the total number of valid base64
characters in the input data must be a multiplier of four.
For example:
Input
ASNFZ4mrze8=
Yields
[%h0123456789abcdef]
(The = in the input string is a pad character.)
Syntax:
<stat> := base64^decode( <input^data>, <input^lgth>,
<output^data>, <output^lgth> );
where:
<stat>, INT,
<input^lgth>, INT,
Example:
int
int
string
string
input^lgth;
output^lgth;
.input^data[ 0:11 ] := [ "ASNFZ4mrze8=" ];
.output^data[ 0:7 ];
input^lgth := 12;
err := base64^decode( input^data, input^lgth, output^data, output^lgth );
Nov-2006
ACI Worldwide Inc.
9-17
BASE64^ENCODE
This procedure converts binary data to base64-encoded data according to the
standard set forth in RFC 1521, section 5.2 Base64 Content-Transfer-Encoding (N.
Borenstein, 1993). Every three bytes of binary data become four bytes of base64encoded data. Pad characters are appended if the input data length is not a multiple
of three. NOTE: This procedure deviates slightly from the standard in that it does not
insert a carriage return/line feed after every 76th output character.
For example:
Input
[%h0123456789abcdef]
Yields
ASNFZ4mrze8=
(The = in the output string is a pad character.)
Syntax:
<stat> := base64^encode( <input^data>, <input^lgth>,
<output^data>, <output^lgth> );
where:
<stat>, INT,
<input^lgth>, INT,
Example:
int
input^lgth;
int
output^lgth;
string .input^data[ 0:7 ] := [ %h01, %h23, %h45, %h67,
%h89, %hab, %hcd, %hef ];
string .output^data[ 0:11 ];
input^lgth := 8;
err := base64^encode( input^data, input^lgth, output^data, output^lgth );
9-18
Nov-2006
ACI Worldwide Inc.
BASE94^DECODE
This procedure converts base94-encoded data to binary format. Every five bytes of
base94-encoded data become four bytes of decoded binary data. The total number
of bytes in the input data must be a multiple of five. The index for base94 includes
the first 94 printable ASCII characters starting with the space character (ASCII 32)
through the closing brace (ASCII 125).
For example:
Input
Yields
j5b{5TfV=S
[%h0022446688aaccee]
Syntax:
<stat> := base94^decode( <input^data>, <input^lgth>,
<output^data>, <output^lgth> );
where:
<stat>, INT,
<input^lgth>, INT,
Example:
int
int
string
string
input^lgth;
output^lgth;
.input^data[ 0:9 ] := [j5b{5TfV=S ];
.output^data[ 0:7 ];
input^lgth := 10;
err := base94^decode( input^data, input^lgth, output^data, output^lgth );
Nov-2006
ACI Worldwide Inc.
9-19
BASE94^ENCODE
This procedure converts binary data to base94-encoded format. Every four bytes of
binary data become five bytes of base94-encoded data. The index for base94
includes the first 94 printable ASCII characters starting with the space character
(ASCII 32) through the closing brace (ASCII 125).
For example:
Input
[%h0022446688aaccee]
Yields
j5b{5TfV=S
(The = in the output string is a pad character.)
Syntax:
<stat> := base94^encode( <input^data>, <input^lgth>,
<output^data>, <output^lgth> );
where:
<stat>, INT,
<input^lgth>, INT,
Example:
int
input^lgth;
int
output^lgth;
string .input^data[ 0:7 ] := [ %h00, %h22, %h44, %h66,
%h88, %haa, %hcc, %hee ];
string .output^data[ 0:9 ];
input^lgth := 8;
err := base94^encode( input^data, input^lgth, output^data, output^lgth );
9-20
Nov-2006
ACI Worldwide Inc.
BINARY^HEXCHAR
Converts binary data to hexadecimal display form. Each 4 bits is unpacked into an
8-bit character representing the 4-bit binary value. For example:
<binary> containing %B00011110 (i.e., a binary 1 in 4 bits followed by a
binary 14 in the next 4 bits)
converts to
<hex> containing %B0011000101000101
"1E"
Syntax:
<stat> := BINARY^HEXCHAR( <hex> , <lgth> , <binary> )
where:
<stat>, INT,
<hex>, STRING:ref,
<lgth>, INT,
<binary>, STRING:ref,
example:
STRING
INT
.hex^str[ 0:13 ],
.binary^str[ 0:6 ];
hex^lgth;
binary^str :=[%h12,%h34,%h56,%h78,%h9A,%hBC];
hex^lgth
:= 14;
IF BINARY^HEXCHAR( hex^str, hex^lgth, binary^str ) THEN
! successful
ELSE
! error
Nov-2006
ACI Worldwide Inc.
9-21
"1E"
Syntax:
<stat> := BINARY^HEXCHARX( <hexx> , <lgth> , <binaryx> )
where:
<stat>, INT,
<hexx>, STRING.EXT:ref,
<lgth>, INT,
<binaryx>, STRING.EXT:ref,
example:
STRING
INT
binary^str :=[%h12,%h34,%h56,%h78,%h9A,%hBC];
hex^lgth := 14;
IF BINARY^HEXCHARX( hex^strx, hex^lgth, binary^strx ) THEN
! successful
ELSE
! error
9-22
Nov-2006
ACI Worldwide Inc.
CRNCY^DECIMAL^PLACES
Accepts the ASCII representation of a currency code and returns the number of
decimal places for the currency code as an integer. The data for the countries was
taken from the ISO manual.
Syntax:
<stat> := CRNCY^DECIMAL^PLACES( <crncy^cde> )
where:
<stat>, INT,
<crncy^cde>, STRING:ref,
example:
Nov-2006
ACI Worldwide Inc.
STRING
INT
crncy^cde
stat
':=' "840";
:= CRNCY^DECIMAL^PLACES( crncy^cde );
9-23
GET^CNTRY^DATA
Accepts the ASCII representation of the country code and returns the currency code
used by the country, the standard abbreviation of the name of the country, and the
number of decimal places used by the currency. The data for the countries was
taken from the ISO manual.
Syntax:
<stat> := GET^CNTRY^DATA( <crncy^cde> , <cntry^cde> , <cntry^abrv> ,
<dec^place> )
where:
<stat>, INT,
<crncy^cde>, STRING:ref,
<cntry^cde>, STRING:ref,
<cntry^abrv>, STRING:ref,
<dec^place>, INT:ref,
example:
STRING
INT
cntry^cde
stat
9-24
Nov-2006
ACI Worldwide Inc.
GET^CRNCY^CDE^ALPHA
Accepts the ASCII representation of the currency code and returns the standard
abbreviation of the name of the country, the number of decimal places used by the
currency, and the alpha representation of the numeric currency code. The data for
the countries was taken from the ISO manual.
Syntax:
<stat> := GET^CRNCY^CDE^ALPHA( <crncy^cde> , ,<cntry^abrv> ,
<dec^place> , <crncy^cde^alpha> )
where:
<stat>, INT,
<crncy^cde>, STRING:ref,
<cntry^abrv>, STRING:ref,
<dec^place>, INT:ref,
Nov-2006
ACI Worldwide Inc.
9-25
CRNCY^DECIMAL^PLACES^ALPHA
Accepts the ALPHA representation of the numeric currency code and returns the
numeric currency code used by the country, and the number of decimal places used
by the currency. The data for the countries was taken from the ISO manual.
Syntax:
<stat> := CRNCY^DECIMAL^PLACES^ALPHA( <crncy^cde>, , ,<dec^place>
, <crncy^cde^alpha> )
where:
<stat>, INT,
<crncy^cde>, STRING:ref,
<dec^place>, INT:ref,
crncy^cde^alpha
':=' "USD";
stat := CRNCY^DECIMAL^PLACES^ALPHA( crncy^cde, , ,
dec^place, crncy^cde^alpha );
9-26
Nov-2006
ACI Worldwide Inc.
DOLLAR^SUPPRESS
Floats a dollar sign.
Syntax:
CALL DOLLAR^SUPPRESS( <amt> , <max^lgth> )
where:
<amt>, STRING:ref,
<max^lgth>, INT,
example:
STRING
INT
.amt[ 0:6 ];
max^lgth;
amt
':=' "0000012";
max^lgth
:= 7;
CALL DOLLAR^SUPPRESS( amt, max^lgth );
result:
amt
="
$12"
amt
':=' "0000.12";
max^lgth
:= 7;
CALL DOLLAR^SUPPRESS( amt, max^lgth );
result:
Nov-2006
ACI Worldwide Inc.
amt
= " $0.12"
9-27
DOUBLE^ASCII
Converts an double-word value to an ASCII number. The number to be converted
must be numeric and greater than or equal to zero. The PROC will return TRUE or
FALSE to indicate whether or not the conversion was successful. An overflow
condition will result in a return of FALSE.
Syntax:
<stat> := DOUBLE^ASCII( <txt> , <txt^lgth> , <val> )
where:
<stat>, INT,
<txt>, STRING:ref,
<val>, INT(32):ref,
example:
STRING
INT
INT (32)
.txt^str[ 0:7 ];
txt^lgth;
val;
txt^lgth
:= 8;
val
:= 82164d;
IF DOUBLE^ASCII( txt^str, txt^lgth, val ) THEN
! successful
ELSE
! error
9-28
Nov-2006
ACI Worldwide Inc.
<txtx>, STRING.EXT:ref,
<val>, INT(32):ref,
example:
STRING
INT
INT (32)
txt^lgth
:= 8;
val
:= 82164d;
IF DOUBLE^ASCIIX( txt^strx, txt^lgth, val ) THEN
! successful
ELSE
! error
Nov-2006
ACI Worldwide Inc.
9-29
DOUBLE^DOLLAR
Converts a double-word value to an ASCII string formatted with a $ and two decimal
places. Leading zeros are suppressed.
Syntax:
CALL DOUBLE^DOLLAR( <amt> , <txt^lgth> , <txt> )
where:
<amt>, INT(32):ref
<txt^lgth>, INT,
<txt>, STRING:ref,
9-30
Nov-2006
ACI Worldwide Inc.
txt^str = "$
821.64 "
Nov-2006
ACI Worldwide Inc.
txt^str = "$
821.64-"
9-31
DOUBLE^DOLLAR^ASTERISK
Converts an INT(32) value to an ASCII string formatted with a $ and two decimal
places. Leading zeroes are replaced with asterisks.
Syntax:
CALL DOUBLE^DOLLAR^ASTERISK( <amt> , <txt^lgth> , <txt> )
where:
<amt>, INT(32):ref
<txt^lgth>, INT,
<txt>, STRING:ref,
9-32
Nov-2006
ACI Worldwide Inc.
txt
= "$*****841.64 "
Nov-2006
ACI Worldwide Inc.
txt
= "$*****841.64-"
9-33
EBCDIC^TO^ASCII
Used to translate a string from EBCDIC characters to ASCII.
Syntax:
CALL EBCDIC^TO^ASCII( <src^str> , <lgth> );
where:
<src^str>, STRING:ref,
example:
STRING
INT
.src^str[ 0:4 ];
lgth;
src^str
':=' [%hC1,%hE2,%hC3,%hC9,%hC9];
lgth
:= 5;
CALL EBCDIC^TO^ASCII( src^str, lgth )
9-34
Nov-2006
ACI Worldwide Inc.
example:
STRING .ext src^strx[ 0:4 ];
INT
lgth;
src^strx
':=' [%hC1,%hE2,%hC3,%hC9,%hC9];
lgth
:= 5;
CALL EBCDIC^TO^ASCIIX( src^strx, lgth )
Nov-2006
ACI Worldwide Inc.
9-35
FIXED^ASCII
Converts a FIXED (64 bit) value to an ASCII number. The number to be converted
must be numeric and greater than or equal to zero. The PROC will return TRUE or
FALSE to indicate whether or not the conversion was successful. An overflow
condition will result in a return of FALSE.
Syntax:
<stat> := FIXED^ASCII( <txt> , <txt^lgth> , <val> )
where:
<stat>, INT,
<txt>, STRING:ref,
<val>, FIXED(*),
example:
STRING
INT
FIXED
.txt^str[ 0:17 ];
txt^lgth;
val;
txt^lgth
:= 18;
val
:= 23984098493983494f;
IF FIXED^ASCII( txt^str, txt^lgth, val ) THEN
...
ELSE
...
9-36
Nov-2006
ACI Worldwide Inc.
<txtx>, STRING.EXT:ref,
<val>, FIXED(*),
example:
STRING .ext txt^strx[ 0:17 ];
INT
txt^lgth;
FIXED
val;
txt^lgth
:= 18;
val
:= 23984098493983494f;
IF FIXED^ASCIIX( txt^strx, txt^lgth, val ) THEN
...
ELSE
...
Nov-2006
ACI Worldwide Inc.
9-37
FIXED^DOLLAR
Converts a FIXED value to an ASCII string formatted with a "$" sign,commas, and
two decimal places. Leading zeros are suppressed.
Syntax:
CALL FIXED^DOLLAR( <amt> , <txt^lgth> , <txt> )
where:
<amt>, FIXED:ref,
<txt^lgth>, INT,
<txt>, STRING:ref,
.output^txt[ 0:26 ];
txt^lgth;
amt;
txt^lgth
:= 27;
amt
:= 23984098493983494f;
CALL FIXED^DOLLAR( amt, txt^lgth, output^txt )
result: output^txt
9-38
Nov-2006
ACI Worldwide Inc.
FIXED^DOLLAR^ASTERISK
Converts a FIXED value to an ASCII string formatted with a "$", commas, and two
decimal places. Leading zeroes are replaced with asterisks.
Syntax:
CALL FIXED^DOLLAR^ASTERISK( <amt> , <txt^lgth> , <txt> )
where:
<amt>, FIXED: ref
.output^txt[ 0:26 ];
edit^lgth;
amt;
edit^lgth := 27;
amt
:= 84164375678998927f;
CALL FIXED^DOLLAR^ASTERISK( amt, edit^lgth, output^txt)
result: output^txt = "$***841,643,756,789,989.27 "
Nov-2006
ACI Worldwide Inc.
9-39
FNUMIN
Converts an ASCII number into a fixed number.
Syntax:
<addr> := FNUMIN( <txt> , <fnum> , <fpoint> , <result> )
where:
<addr>, INT,
<txt>, STRING:ref,
<fnum>, FIXED:ref,
<fpoint>, INT,
<result>, INT:ref,
example:
STRING
INT
9-40
FIXED
.txt[ 0:5 ];
.addr,
.result,
fpoint;
fnum;
fpoint
txt
@addr
:= 0;
':=' "123456";
:= FNUMIN( txt, fnum, fpoint, result );
Nov-2006
ACI Worldwide Inc.
FNUMOUT
Converts a fixed positive or negative number from binary to ASCII. The ASCII
number will be zero suppressed, and either right or left justified, depending upon the
flag parameter.
Syntax:
<addr> := FNUMOUT( <txt> , <fnum> , <scale> ,<width> , <stat> , <flags> )
where:
<addr>, INT,
<txt>, STRING:ref,
<fnum>, FIXED(*),
<scale>, INT,
<width>, INT,
<stat>, INT:ref,
<flags>, INT,
Nov-2006
ACI Worldwide Inc.
9-41
9-42
FIXED
.txt [0:7 ];
.addr,
scale,
width,
stat,
flags;
fnum;
fnum
width
flag
scale
@addr
:= -123456F;
:= 8;
:= 0;
:= 2;
:= FNUMOUT( txt, fnum, scale, width,stat, flags );
result
text
"-1234.56"
Nov-2006
ACI Worldwide Inc.
FORMATTED^FNUMOUT
Converts a fixed number into its ASCII representation, using a template similar to a
COBOL PICTURE.
Syntax:
<stat> := FORMATTED^FNUMOUT( <outbuf> , <fnum> ,<template> )
where:
<stat>, INT,
<outbuf>, STRING:ref,
<fnum>, FIXED,
<template>, STRING:ref,
NOTE: This utility doesn't do strenuous error checking on the template. For
example, "99,99,9,999.99" would be accepted, with the results just as
you would expect.
Nov-2006
ACI Worldwide Inc.
9-43
.ext
.ext
outbuf[ 0:9 ],
template[ 0:9 ];
stat;
fnum;
:= 123456F;
':=' "$99,999.99";
:= FORMATTED^FNUMOUT( outbuf,fnum,template );
9-44
Nov-2006
ACI Worldwide Inc.
GRAPHIC^HEX
Converts ASCII "graphics" to an 8 byte packed binary field. The characters 0-9 and
":", ";", "<", "=", ">" and "?" are used to represent the hex- characters 0-9, A-F. Each
8 bits representing a character from "0" through "9" in <graphic^str> has its
corresponding binary value packed into the next subsequent 4 bits in <binary^str>.
The ":", ";", "<", "=", ">", and "?" in graphic string are converted to binary 10 through
15 respectively and are packed into the subsequent 4 bits in <binary^str>. For
example,
<graphic^str> containing "1>" = %B0011000100111110
converts to
<binary^str> which contains %B00011110
Syntax:
<stat> := GRAPHIC^HEX( <graphic^str>, <binary^str> )
where:
<stat>, INT,
<graphic^str>, INT:ref,
<binary^str>, INT:ref,
example:
INT
.graphic^str[ 0:7 ],
.binary^str[ 0:3 ];
graphic^str
':=' "123456:=";
Nov-2006
ACI Worldwide Inc.
9-45
HEXCHAR^BINARY
Converts data representing hex digits in ASCII display form to internal binary form.
Each 8 bits representing a character in <hex> has its corresponding binary value
packed into the next subsequent 4 bits in <binary>. For example,
<hex> containing %B0011000101000101 = "1E"
converts to
<binary> containing %B00011110 ( i.e., a binary 1 in 4 bits followed by a
binary 14 in the next 4 bits)
Syntax:
<stat> := HEXCHAR^BINARY( <hex> , <lgth> , <binary> )
where:
9-46
<stat>, INT,
<hex>, STRING:ref,
<lgth>, INT,
<binary>, STRING:ref,
Nov-2006
ACI Worldwide Inc.
.hex^str[ 0:15 ];
hex^lgth;
.binary^str[ 0:7 ];
hex^str
':=' "0123456789ABCDEF";
hex^lgth
:= 16;
IF HEXCHAR^BINARY( hex^str, hex^lgth, binary^str ) THEN
! successful
ELSE
! error
Nov-2006
ACI Worldwide Inc.
9-47
9-48
<stat>, INT,
<hexx>, STRING.EXT:ref,
<lgth>, INT,
<binaryx>, STRING.EXT:ref,
Nov-2006
ACI Worldwide Inc.
Nov-2006
ACI Worldwide Inc.
9-49
HEXCHAR^INTEGER
Converts a single hex character value ("0"-"F") into its integer equivalent (0-15). If
the hex character to be converted is invalid, the PROC returns FALSE.
Syntax:
<stat> := HEXCHAR^INTEGER( <hexval> , <intval> )
where:
<stat>, INT,
<hexval>, STRING:ref,
<intval>, INT:ref,
example:
INT
9-50
STRING
stat,
intval;
hexval;
hexval
stat
:= "A";
:= HEXCHAR^INTEGER( hexval, intval );
Nov-2006
ACI Worldwide Inc.
INTEGER^ASCII
Converts an INT value to an ASCII number. The number to be converted must be
numeric and greater than or equal to zero. The PROC will return TRUE or FALSE to
indicate whether or not the conversion was successful. An overflow condition results
in a return of FALSE.
Syntax:
<stat> := INTEGER^ASCII( <txt> , <txt^lgth> , <val> )
where:
<stat>, INT,
<txt>, STRING:ref,
<val>, INT,
example:
STRING
INT
.txt^str[ 0:2 ];
txt^lgth,
val;
txt^lgth
:= 3;
val
:= 12;
IF INTEGER^ASCII( txt^str, txt^lgth, val ) THEN
! successful
ELSE
! error
Nov-2006
ACI Worldwide Inc.
9-51
<txtx>, STRING.EXT:ref,
<val>, INT,
example:
STRING
INT
txt^lgth
:= 3;
val
:= 12;
IF INTEGER^ASCIIX( txt^strx, txt^lgth, val ) THEN
! successful
ELSE
! error
9-52
Nov-2006
ACI Worldwide Inc.
INTEGER^HEXCHAR
Converts an integer value (0-15) into its hex character equivalent ("0"-"F"). If the
integer to be converted is invalid, the PROC returns FALSE.
Syntax:
<stat> := INTEGER^HEXCHAR( <hexval> , <intval> )
where:
<stat>, INT,
<hexval>, STRING:ref,
<intval>, INT:val,
example:
INT
Nov-2006
ACI Worldwide Inc.
STRING
stat,
intval;
hexval;
intval
stat
:= 15;
:= INTEGER^HEXCHAR( hexval, intval );
9-53
SET^PARITY
Sets the parity (leftmost) bit on each character in the supplied buffer so that overall
character parity becomes even or odd as requested. Note that none of the
parameters has its value changed; only the supplied buffer is modified.
Syntax:
CALL SET^PARITY( eptr, lgth, even );
where:
<eptr>, STRING.EXT;ref,
<lgth>, INT:val,
<even>, INT:val,
example:
INT
lgth
:= 120,
even
:= -1,
not^even
:= 0;
STRING
.buf^s[ 0:lgth -1 ],
.ext eptr;
@eptr
! true
:= $XADR( buf^s );
9-54
Nov-2006
ACI Worldwide Inc.
TRANSLATE
Used to translate a string from one character set to another:
1) ASCII to EBCDIC,
2) EBCDIC to ASCII,
3) ASCII to DATAPRODUCTS 2230 line printer subset.
Syntax:
CALL TRANSLATE( <src^str> , <lgth> , <translation> )
where:
<src^str>, STRING:ref,
<lgth>, INT,
<translation>, INT,
example:
LITERAL
STRING
INT
ascii^to^ebcdic^l
.txt^str[ 0:15 ];
lgth,
translate^typ;
= 0;
txt^str
:= "translate text";
lgth
:= 14;
translate^typ := ascii^to^ebcdic^l;
CALL TRANSLATE( txt^str, lgth, translate^typ );
Nov-2006
ACI Worldwide Inc.
9-55
<lgth>, INT,
<translation>, INT,
example:
LITERAL
ascii^to^ebcdic^l
STRING .ext txt^strx[ 0:15 ];
INT
lgth,
translate^typ;
= 0;
txt^strx
:= "translate text";
lgth
:= 14;
translate^typ := ascii^to^ebcdic^l;
CALL TRANSLATEX( txt^strx, lgth, translate^typ );
9-56
Nov-2006
ACI Worldwide Inc.
ZDNUMIN
Converts an ASCII string to a signed double word. It performs the same function as
Tandem's NUMIN procedure except that the ASCII number is converted to an
INT(32) instead of an integer.
Syntax:
<addr> := ZDNUMIN( <str> , <dnum> , <base> , <stat> )
where:
<addr>, INT,
<str>, STRING:ref,
<dnum>, INT(32):ref,
<base>, INT,
<stat>, INT:ref,
example:
STRING
INT
Nov-2006
ACI Worldwide Inc.
INT(32)
.ascii^num[ 0:2 ];
.addr,
base,
stat;
dnum;
ascii^num
base
@addr
':=' "123";
:= 10;
:= ZDNUMIN( ascii^num, dnum, base, stat );
9-57
ZDNUMOUT
Converts a signed double word to an ASCII string. It performs the same function as
Tandem's NUMOUT procedure except that an INT(32) number is converted to an
ASCII string.
Syntax:
<addr> := ZDNUMOUT( <strng> , <dnum> , <base> , <width> )
where:
<addr>, INT,
<strng>, STRING:ref,
<dnum>, INT(32),
<base>, INT,
<width>, INT,
example:
STRING
INT
INT(32)
.ascii^num[ 0:3 ];
.addr,
base,
width;
dnum;
dnum
base
width
@addr
:= 123d;
:= 10;
:= 4;
:= ZDNUMOUT( ascii^num, dnum, base, width );
9-58
Nov-2006
ACI Worldwide Inc.
ZNUMOUT
Converts an unsigned integer value to its ASCII equivalent. If the width is passed
then the result is right justified. Otherwise it returned left justified.
Syntax:
<addr> := ZNUMOUT( <str> , <num> , <base> , <width> )
where:
<addr>, INT,
<str>, STRING:ref,
<num>, INT,
<base>, INT,
<width>, INT,
example:
STRING
INT
.ascii^num[ 0:3 ];
.addr,
num,
base,
width;
num
base
width
@addr
:= 123
:= 10;
:= 4;
:= ZNUMOUT( ascii^num, num, base, width );
Nov-2006
ACI Worldwide Inc.
9-59
9-60
Nov-2006
ACI Worldwide Inc.
Section 10
Manipulation
String Manipulation
CONVERT^FIELD^JUSTIFICATION
Converts a field that is right justified, zero filled on the left to a field that is left
justified, blank filled on the right and vice versa.
Syntax:
CALL CONVERT^FIELD^JUSTIFICATION( <rt^field> , <rt^field^lgth> ,
<lf^field> , <lf^field^lgth> ,
<conv^dir> );
where:
<rt^field>, STRING:ref,
<rt^field^lgth>, INT:value,
<lf^field>, STRING:ref,
<lf^field^lgth>, INT:value,
<conv^dir>, INT:value,
example:
LITERAL
right^to^left^l
left^to^right^l
STRING
.rt^field[ 0:10 ],
.lf^field[ 0:10 ];
= 0,
= 1;
rt^field
':=' "0000justify";
CALL convert^field^justification( rt^field, 11,lf^field, 11,
right^to^left^l );
Nov-2006
ACI Worldwide Inc.
10-1
Manipulation
CONVERT^STATE^CODE
CONVERT^STATE^CODE
Converts a two digit state code to a two letter state code and back. The state table
built is based on fips processing standards publication 6-3.
Syntax:
<stat> := CONVERT^STATE^CODE( <scode> , <alpha> , <direction> )
where:
<stat>, INT,
<scode>, STRING:ref,
<alpha>, STRING:ref,
<direction>, INT,
example:
LITERAL
num^to^letter^cde^l
letter^to^num^cde^l
= 1,
= 0;
10-2
Nov-2006
ACI Worldwide Inc.
Manipulation
DELETE^EXTRA^BLANKS
DELETE^EXTRA^BLANKS
Removes extra blanks from a string buffer. 'Extra blanks' are defined as leading
blanks, trailing blanks, or any occurrence of two or more consecutive blanks (which
are reduced to one blank). Blanks which occur within quotes are not affected (quotes
within a string are denoted by two consecutive quotation marks).
Syntax:
CALL DELETE^EXTRA^BLANKS( <str> , <lgth> )
where:
<str>, STRING:ref,
<lgth>, INT:ref,
example:
STRING
INT
.str[ 0:21 ];
lgth;
lgth
:= 22;
str
':=' " 123 "" ab ""hello";
CALL DELETE^EXTRA^BLANKS( str, lgth );
result: str
lgth
Nov-2006
ACI Worldwide Inc.
10-3
Manipulation
FIELD^FINDER
FIELD^FINDER
Given a string of data and an offset from the data string where the search is to begin,
returns the pointer to a data string containing either alpha or numeric data. The
search starting position is the first byte at or after the offset position which contains
alpha or numeric data. The search is discontinued when a data type other than that
specified in the search starting position is encountered. The string array to be
searched must be terminated by a null value.
Syntax:
<addr> := FIELD^FINDER( <in> , <typ> , <ofst^or^lgth> )
where:
10-4
<addr>, STRING,
<in>, STRING:ref,
<typ>, INT:ref,
<ofst^or^lgth>, INT:ref,
Nov-2006
ACI Worldwide Inc.
Manipulation
FIELD^FINDER
example:
STRING
INT
Nov-2006
ACI Worldwide Inc.
.str^addr,
.txt[ 0:10 ];
typ,
lgth;
txt
lgth
@str^addr
result:
10-5
Manipulation
FIND^STRING
FIND^STRING
Scans a string array for the occurrence of a specified string. FIND^STRING returns
zero if the search string was not found. If found, FIND^STRING returns the address
of the occurrence.
Syntax:
<addr> := FIND^STRING( <array> , <search^str> , <str^lgth^or^ofst> )
where:
<addr>, INT,
10-6
<array>, STRING:ref,
<search^str>, STRING:ref,
<str^lgth^or^ofst>, INT:ref,
Nov-2006
ACI Worldwide Inc.
Manipulation
FIND^STRING
example:
STRING
INT
Nov-2006
ACI Worldwide Inc.
.scan^array[ 0:20 ],
.search^str[ 0:1 ];
found,
ofst^flg;
scan^array
search^str
ofst^flg
found
result:
10-7
Manipulation
FORMAT^DECIMAL
FORMAT^DECIMAL
Places a decimal point in the input string given the number of decimal places. If a
decimal point already exists, the string is padded or truncated to that many decimal
places. Returns FALSE (0) if non- numeric data was entered. For example, if the
input string contains "12335" and the number of decimal places requested is 4, the
result would be "1.2335", but if the string was "123.35" the result becomes
"123.3500".
Syntax:
<stat> := FORMAT^DECIMAL( <input^str>, <input^lgth>, <output^str>,
<output^lgth>, <num^dec^places> )
where:
<stat>, INT,
<input^str>, STRING:ref,
<input^lgth>, INT,
<output^str>, STRING:ref:
10-8
<output^lgth>, INT,
<num^dec^places>, INT,
Nov-2006
ACI Worldwide Inc.
Manipulation
FORMAT^DECIMAL
example:
STRING
INT
.input^str[ 0:7 ],
.output^str[ 0:9 ];
input^lgth,
output^lgth,
num^dec^places;
input^str
':=' "12345678";
input^lgth
:= 8;
output^lgth := 10;
num^dec^places := 4;
IF FORMAT^DECIMAL( input^str, input^lgth, output^str,
output^lgth, num^dec^places ) THEN
! valid string
ELSE
! error occurred
Nov-2006
ACI Worldwide Inc.
10-9
Manipulation
LEFT^JUSTIFY
LEFT^JUSTIFY
Moves a string array to the left. Blanks are suppressed and inserted at the right. For
example:
the string array:
" contents"
becomes:
"contents "
Syntax:
CALL LEFT^JUSTIFY( <str^array>, <str^lgth> )
where:
<str^array>, STRING:ref,
<str^lgth>, INT,
example:
STRING
INT
.str^array[ 0:9 ];
str^lgth;
str^lgth
:= 10;
str^array
':=' " 12354";
CALL LEFT^JUSTIFY( str^array, str^lgth );
10-10
Nov-2006
ACI Worldwide Inc.
Manipulation
MOD10^ADD
MOD10^ADD
Used to perform mod-10 addition on two buffers which contain ASCII- numeric data.
The two buffers are right-aligned and added mod-10, digit by digit.
Syntax:
<stat> := MOD10^ADD( <num1> , <num2> , <num1^lgth> , <num2^lgth> ,
<result> );
where:
<stat>, INT,
returns TRUE if input data was valid ASCIInumeric data and is at most 16 bytes long;
otherwise, zero-fills result and returns
FALSE.
<num1>, STRING:ref,
<num2>, STRING:ref,
<num1^lgth>, INT:val,
<num2^lgth>, INT:val,
<result>, STRING:ref,
NOTE: Neither buffer may exceed 16 bytes. Also, note that the result will be
<n> digits, where <n> equals $max( <num1^lgth>, <num2^lgth> ).
example:
STRING
.num1[ 0:15 ] := "56928",
.num2[ 0:15 ] := "01234",
.result[ 0:15 ];
INT
num1^lgth := 5,
num2^lgth := 5;
CALL MOD10^ADD( num1, num2, num1^lgth, num2^lgth, result);
result: result = "57152"
Nov-2006
ACI Worldwide Inc.
10-11
Manipulation
MOD10^ADDX (extended address version)
returns TRUE if input data was valid ASCIInumeric data and is at most 16 bytes long;
otherwise, zero-fills result and returns
FALSE.
<num1x>, STRING:ref,
<num2x>, STRING:ref,
<num1^lgth>, INT:val,
<num2^lgth>, INT:val,
<resultx>, STRING:ref,
NOTE: Neither buffer may exceed 16 bytes. Also, note that the result will be
<n> digits, where <n> equals $max( <num1^lgth>, <num2^lgth> ).
example:
STRING .ext num1x[ 0:15 ]
:= "56928",
.ext num2x[ 0:15 ]
:= "1234",
.ext resultx[ 0:15 ];
INT
num1^lgth
:= 5,
num2^lgth
:= 4;
CALL MOD10^ADDX(num1x, num2x, num1^lgth, num2^lgth,resultx);
result: resultx = "57152"
10-12
Nov-2006
ACI Worldwide Inc.
Manipulation
MOD10^SUBTRACT
MOD10^SUBTRACT
Used to perform mod-10 subtraction on two buffers which contain ASCII numeric
data. The two buffers are right-aligned and subtracted mod-10, digit by digit.
Syntax:
<stat> := MOD10^SUBTRACT( <num1> , <num2> , <num1^lgth> ,
<num2^lgth> , <result> );
where:
<stat>, INT,
returns TRUE if input data was valid ASCIInumeric data and is at most 16 bytes long;
otherwise, zero-fills result and returns
FALSE.
<num1>, STRING:ref,
<num2>, STRING:ref,
<num1^lgth>, INT:val,
<num2^lgth>, INT:val,
<result>, STRING:ref,
NOTE: Neither buffer may exceed 16 bytes. Also note that the result will be
<n> digits, where <n> equals $max( num1^lgth, num2^lgth ).
example:
STRING
.num1[ 0:15 ]
:= "56928",
.num2[ 0:15 ]
:= "1234",
.result[ 0:15 ];
INT
num1^lgth
:= 5,
num2^lgth
:= 4;
CALL MOD10^SUBTRACT( num1, num2, num1^lgth, num2^lgth,
result );
result: result = "55794"
Nov-2006
ACI Worldwide Inc.
10-13
Manipulation
MOD10^SUBTRACTX (extended address version)
returns TRUE if input data was valid ASCIInumeric data and is at most 16 bytes long;
otherwise, zero-fills result and returns
FALSE.
<num1x>, STRING.EXT:ref,
<num2x>, STRING.EXT:ref,
<num1^lgth>, INT:val,
<num2^lgth>, INT:val,
<resultx>, STRING.EXT:ref,
NOTE: Neither buffer may exceed 16 bytes. Also note that the result will be
<n> digits, where <n> equals $max( num1^lgth, num2^lgth ).
example:
STRING
.ext num1x[ 0:15 ] := "56928",
.ext num2x[ 0:15 ] := "1234",
.ext resultx[ 0:15 ];
INT
num1^lgth := 5,
num2^lgth := 4;
CALL MOD10^SUBTRACTX( num1x, num2x, num1^lgth,
num2^lgth, resultx );
result: result = "55794"
10-14
Nov-2006
ACI Worldwide Inc.
Manipulation
PACK
PACK
Packs one string into another using the following packing algorithm:
<sub> <char> <count code>
<sub>
- is the ASCII sub character (%h1A)
<char>
- the character packed
<count code>
- specifies the number of consecutive <char>'s replaced
by the pack sequence. It is related to the actual character
count by: <count code> := <actual count> - 3 + "@" ("@"
= %h40).
Syntax:
<stat> := PACK( <in^buf>, <in^lgth>, <out^buf>, <out^lgth>, <out^size> )
where:
<stat>, INT,
<in^buf>, STRING:ref,
<in^lgth>, INT,
<out^buf>, STRING:ref:<out^size>,
<out^lgth>, INT:ref,
<out^size>, INT,
Nov-2006
ACI Worldwide Inc.
10-15
Manipulation
PACK
example:
STRING
INT
.in^buf[ 0:9 ],
.out^buf[ 0:19 ];
in^lgth,
out^lgth,
max^lgth;
in^lgth
:= 11;
max^lgth
:= 20;
IF PACK( in^buf, in^lgth, out^buf,out^lgth, max^lgth ) THEN
! successful pack
ELSE
! error condition
10-16
Nov-2006
ACI Worldwide Inc.
Manipulation
REMOVE^BLANKS
REMOVE^BLANKS
Removes blanks from a string array and left justifies the characters in the process.
For example:
" my data " becomes "mydata
"
Syntax:
CALL REMOVE^BLANKS( <str^array>, <str^lgth> )
where:
<str^array>, STRING:ref,
<str^lgth>, INT,
example:
STRING
INT
.str^array[ 0:9 ];
str^lgth;
str^array
':=' " my data";
str^lgth
:= 10;
CALL REMOVE^BLANKS( str^array, str^lgth );
Nov-2006
ACI Worldwide Inc.
10-17
Manipulation
REMOVE^NON^NUMERIC
REMOVE^NON^NUMERIC
Removes non-numerics from a string array. For example:
the character string "abc12cd34" becomes "1234
"
Syntax:
CALL REMOVE^NON^NUMERIC( <str^array>, <str^lgth> )
where:
<str^array>, STRING:ref,
<str^lgth>, INT:ref,
example:
STRING
INT
.str^array[ 0:9 ];
str^lgth;
str^array
':=' "123 my 890";
str^lgth
:= 10;
CALL REMOVE^NON^NUMERIC( str^array, str^lgth );
10-18
Nov-2006
ACI Worldwide Inc.
Manipulation
RIGHT^JUSTIFY
RIGHT^JUSTIFY
Moves a string array to the right. Only rightmost blanks are sup-pressed and inserted
at the left. For example:
the character string "123 abc " becomes " 123 abc"
Syntax:
CALL RIGHT^JUSTIFY( <str^array>, <str^lgth> )
where:
<str^array>, STRING:ref,
<str^lgth>, INT,
example:
STRING
INT
.str^array[ 0:9 ];
str^lgth;
str^array
':=' "123abc ";
str^lgth
:= 10;
CALL RIGHT^JUSTIFY( str^array, str^lgth );
Nov-2006
ACI Worldwide Inc.
10-19
Manipulation
STRLEN
STRLEN
Computes and returns the length of an input string. The string must be terminated by
a null delimiter at the end, and any trailing blanks (preceding the null) will be ignored.
Syntax:
<lgth> := STRLEN( <str> , <max^lgth> )
where:
<lgth>, INT:ref,
<str>, INT:ref,
example:
10-20
STRING
INT
.str^blk[ 0:9 ];
lgth,
max^lgth;
str^blk
max^lgth
lgth
Nov-2006
ACI Worldwide Inc.
Manipulation
STRLENX (extended address version)
<strx>, INT:ref,
example:
STRING .ext strx[ 0:9 ];
INT
max^lgth,
lgth;
strx
max^lgth
lgth
Nov-2006
ACI Worldwide Inc.
10-21
Manipulation
SYM^NAME^LEN
SYM^NAME^LEN
Determines the length of a symbolic name, without the trailing blanks. A symbolic
name can contain Alpha Numberic Characters plus ^ and -
Syntax:
<lgth> := SYM^NAME^LEN( <sym^name> )
where:
<lgth>, INT,
lgth;
.sym^name[0:15]
sym^name :=PROC-NAME^LEN.?*;
lgth :=SYM^NAME^LEN(sym^name);
results:
10-22
Nov-2006
ACI Worldwide Inc.
Manipulation
UNPACK
UNPACK
Unpacks one string into another using the following packing algorithm:
<sub> <char> <count code>
<sub>
- is the ASCII sub character (%h1A)
<char>
- the character packed
<count code>
- specifies the number of consecutive <char>'s replaced
by the pack sequence. It is related to the actual character
count by:
<count code> := <actual count> - 3 + "@". ("@" = %h40)
Syntax:
<stat> := UNPACK( <in^buf>, <in^lgth>, <out^buf>, <out^lgth>,<out^size> )
where:
<stat>, INT,
<in^buf>, STRING:ref,
<in^lgth>, INT,
<out^buf>, STRING:ref,
<out^lgth>, INT:ref,
<out^size>, INT,
Nov-2006
ACI Worldwide Inc.
10-23
Manipulation
UNPACK
example:
STRING
INT
.in^buf[ 0:9 ],
.out^buf[ 0:19 ];
in^lgth,
out^lgth,
max^lgth;
in^lgth
:= 11;
max^lgth
:= 20;
IF UNPACK( in^buf, in^lgth, out^buf,out^lgth, max^lgth ) THEN
! successful
ELSE
! error condition
10-24
Nov-2006
ACI Worldwide Inc.
Manipulation
VALID^DECIMAL^NUMBER
VALID^DECIMAL^NUMBER
Checks for a valid decimal number and returns an index to the decimal point if it
exists (e.g., if the input string contains "1234.789", the index would be returned as 4).
Returns TRUE (-1) if the input string is a valid decimal number.
Syntax:
<stat> := VALID^DECIMAL^NUMBER( <str^array>, <str^lgth>, <decimal^idx>
)
where:
<stat>, INT,
<str^array>, STRING:ref,
<str^lgth>, INT,
<decimal^idx>, INT,
example:
STRING
INT
.str^array[ 0:9 ];
str^lgth,
decimal^index;
str^array
':=' "1234567.00";
str^lgth
:= 10;
IF VALID^DECIMAL^NUMBER( str^array, str^lgth,
decimal^index )THEN
! valid decimal number
ELSE
! invalid decimal number
Nov-2006
ACI Worldwide Inc.
10-25
Manipulation
ZERO^SUPPRESS
ZERO^SUPPRESS
Replaces leading zeros with blanks. For example:
the character string "00001234.69" becomes "
1234.69"
Syntax:
CALL ZERO^SUPPRESS( <str^array>, <str^lgth> )
where:
<str^array>, STRING:ref,
<str^lgth>, INT,
example:
STRING
INT
.str^array[ 0:9 ];
str^lgth;
str^array
':=' "0000123.49";
str^lgth
:= 10;
CALL ZERO^SUPPRESS( str^array, str^lgth );
10-26
Nov-2006
ACI Worldwide Inc.
Manipulation
ZERO^SUPPRESS
Data Manipulation
These procedures allow you to work with memory above 32K. They have two major
functions, to compare one area of memory to another, or to move one area of
memory to another.
To simplify the use of these PROCs when using structs, source in the file
$<VOL>.ACIUTILS.UTILDEFS( DCF^DEFINES ). This file contains a series of
DEFINEs as described on the following page.
These require copystruct and comparestruct sections from
$<VOL>.ACIUTILS.UTILEXTS
Examples are given using the following struct definitions:
STRUCT
my^crd;
BEGIN
STRUCT
mynam;
BEGIN
STRING
bytes[ 0:29 ];
END;
INT
crd^id;
STRING
ssn[ 0:8 ];
END;
STRUCT
emp^crd;
BEGIN
STRUCT
emp^nam;
BEGIN
STRING
bytes[ 0:29 ];
END;
INT
comp^id;
INT(32)
emp^date;
STRING
ssn[ 0:8 ];
STRUCT
address;
BEGIN
STRING
bytes[ 0:20 ];
END;
END;
Nov-2006
ACI Worldwide Inc.
10-27
Manipulation
DEFINEs
DEFINEs
NOTE: The parameters <from> and <to>, represent the base address of the struct,
while <fromfield> and <tofield> are the data items byte offset.
CFIELDLITNU( lit, litlen, to, field ) - moves a literal to a field within a struct. No
upshifting is done. Example:
CFIELDLITNU( "JOHN DOE", 8, mycrd, mynam )
CFIELDLIT( lit, litlen, to, field ) - upshifts the literal and moves it to a field in a struct.
CFIELDLIT1( lit, litlen, to, field, fill ) - moves a literal to a field and pads with fill
character. Example:
CFIELDLIT1( "JOHN DOE", 8, mycrd, mynam, " " )
CFIELDNU( from, to, field ) - moves one like field to another. No upshifting is done.
Example:
CFIELDNU( mycrd, emp^crd, ssn )
CFIELD( from, to, field ) - upshifts the field to be moved and moves it to a like field.
COMPFIELDNU( from, to, field ) - compares two like fields and returns TRUE if
equal. Does not upshift to do the compare.
Example:
IF COMPFIELDNU( mycrd, emp^crd, ssn ) THEN
...
ELSE
...
COMPFIELD( from, to , field ) - compares two like fields in uppercase.
CSTRUCTNU( from, fromfield, to, tofield ) - copies one data area to another. Does
not upshift. Example:
CSTRUCTNU( mycrd, mynam, emp^crd, emp^nam )
CSTRUCT( from, fromfield, to, tofield ) - upshifts the field to be moved and then
moves it to another data area.
10-28
Nov-2006
ACI Worldwide Inc.
Manipulation
DEFINEs
COMPSTRUCTNU( from, fromfield, to, tofield ) - compares one data area to another.
Returns TRUE if they are equal. Does not upshift to do the
compare.
Example:
IF COMPSTRUCTNU( mycrd, mynam, emp^crd, emp^nam ) THEN
... !equal condition
ELSE
...
COMPSTRUCT( from, fromfield, to, tofield ) - compares one data area to another in
uppercase.
Nov-2006
ACI Worldwide Inc.
10-29
Manipulation
UPSHIFT^FIELD
UPSHIFT^FIELD
Used to upshift an area in memory.
Syntax:
CALL UPSHIFT^FIELD( <base>, <ofst>, <lgth> )
where:
<base>, INT:ref,
<ofst>, INT,
<lgth>, INT,
example:
INT
.fld[ 0:9 ],
ofst,
fld^lgth;
ofst
:= 0;
fld^lgth
:= 20;
CALL UPSHIFT^FIELD( @fld, ofst, fld^lgth );
NOTE: This procedure does not upshift for <lgth> if a field terminator is
contained in the area to be upshifted. Commas and possibly other
such characters will stop this procedure.
Example: abcd,ef becomes ABCD
It is recommended that the NSK call to the SHIFTSTRING procedure
be used INSTEAD of upshift^field.
10-30
Nov-2006
ACI Worldwide Inc.
Section 11
Timer Routines
Overview
There are two sets of timer routines that provide an easy method of working with
interval timers.
The User Data Segment Timer Routines work on timers allocated in the User Data
Segment (the lower and upper 64K bytes of global memory).
The Extended Memory Segment Timer Routines take advantage of extended
memory segments. Due to the memory space available in Extended Memory, these
routines support substantially more timers. Over six million timers could be
supported in one extended memory segment, however using large numbers of timers
may produce performance burdens on the system.
There is a significant difference in the timestamp used by each set of timer routines.
The NSK system supports a proprietary 48-bit timestamp, and a 64-bit Julian
Timestamp. The User Data Segment Timer Routines utilize the 48-bit timestamp,
while the Extended Memory Segment Timer Routines use the Julian Timestamp.
The NSK system changes the 48-bit timestamp value during Daylight Savings Time.
The Julian Timestamp is not altered for Daylight Savings Time. Consequently, the
User Data Segment Timers are affected by the Daylight Savings Time change,
whereas the Extended Memory Segment Timer Routines are not.
These two sets are not interchangeable.
Nov-2006
ACI Worldwide Inc.
11-1
Timer Routines
User Data Segment Timer Routines
timer^def( * );
next;
exptime;
et[ 0:3 ] = exptime;
typ;
subtyp;
userbuf;
s^userbuf = userbuf;
timer^control^block^def( * );
first^timer^addr,
free^timer^addr,
num^of^timers,
timer^depth,
max^timer^depth;
END;
The userbuf element of the timer^def structure locates a word address at the end of
each timer where user data can be placed. When timers are initialized, the word size
of the largest user data area is specified so that the timers are allocated in memory
with space at the end of each timer for a data structure of the developers choice.
The address of a particular timer is returned by each of the following procs:
FIND^SPECIFIC^TIMER, TIMER^EXPIRED, and TIMER^INSERT. This address can
be used to locate the beginning of the userdata areas for application specific
purposes.
The user should modify no other area of the timer structure.
To use these procs do the following:
1) Source in =ACIUTILS_UTILDEFS( timer^structs ) in your program where
struct templates are defined.
2) Declare timer control block (using TIMER^CONTROL^BLOCK^DEF).
11-2
Nov-2006
ACI Worldwide Inc.
Timer Routines
User Data Segment Timer Routines
3) Declare the timer table large enough to contain the maximum number of
timers, plus any user data associated with timer elements.
4) CALL TIMER^INIT before calling any other TIMER procedures.
Example:
LITERAL
timer^user^buf^lgth^l
num^of^timers^l
timer^entry^size^l
timer^tbl^limit^l
tcb( timer^control^block^def );
. timer^tbl[ 0:timer^tbl^limit ];
= 0,
= 1,
= 2,
= 40;
:= -1;
:= next^expire^time( tcb );
11-3
Timer Routines
User Data Segment Timer Routines
BEGIN
CALL process^timeout( timer );
@timer := timer^expired( tcb, true );
END;
END
ELSE
! handle file error, other than timeout
END
ELSE
! handle normal i/o completion ...
11-4
Nov-2006
ACI Worldwide Inc.
Timer Routines
DELETE^THIS^TIMER
DELETE^THIS^TIMER
Designed to be used after a call to timer^expired or find^specific^timer, when the
location of the timer that is to be deleted is known.
Syntax:
<status> := DELETE^THIS^TIMER( <tcb>, <timer> );
where:
<status>, INT,
<tcb>,INT:ref,
<timer>, INT:ref,
example:
@timer := find^specific^timer( tcb, type^1 );
IF not DELETE^THIS^TIMER( tcb, timer ) THEN
BEGIN
CALL log^message( timer^not^found );
END;
Nov-2006
ACI Worldwide Inc.
11-5
Timer Routines
FIND^SPECIFIC^TIMER
FIND^SPECIFIC^TIMER
Used to find the first timer (i.e., the one with the earliest expiration time), which
matches the calling parameters.
Syntax:
<timer^addr> := FIND^SPECIFIC^TIMER( <tcb>, <typ>, <subtyp>, <userbuf>,
<userbufsize> )
where:
<timer^addr>, INT,
<tcb>,INT:ref,
<typ>, INT,
<subtyp>, INT,
<userbuf>, INT:ref,
<userbufsize>, INT,
This is a variable type procedure. Only <tcb> is required. The rest of the
parameters are optional. If no additional parameters are specified, no timer
will be located.
If <userbuf> or <userbufsize> are specified, both are required.
example:
@timer := FIND^SPECIFIC^TIMER( tcb, typ, subtyp, userbuf, userbufsize );
11-6
Nov-2006
ACI Worldwide Inc.
Timer Routines
NEXT^EXPIRE^TIME
NEXT^EXPIRE^TIME
Returns the time interval, in hundredths of a second, which must pass before the next
timer expires.
Syntax:
<wait^time> := NEXT^EXPIRE^TIME( <tcb> )
where:
<wait^time>, INT(32),
The value that is returned may be passed directly as the <wait time>
parameter in the AWAITIO[X] procedure.
<tcb>, INT:ref,
example:
file := -1;
wait^time := NEXT^EXPIRE^TIME( tcb );
CALL awaitio( file, , , , timer^wait );
Nov-2006
ACI Worldwide Inc.
11-7
Timer Routines
TIMER^DELETE
TIMER^DELETE
Used to delete one or more timers from the timer list.
Syntax:
<error> := TIMER^DELETE(<tcb>, <typ>, <subtyp>, <userbuf>, <userbufsize>)
where:
<error>, INT
<tcb>, INT:ref,
<typ>, INT,
<subtyp>, INT,
<userbuf>, INT:ref,
<userbufsize>, INT,
This is a variable type procedure. Only <tcb> is required. The rest of the
parameters are optional. If no additional parameters are specified, no timer
will be deleted.
If <userbuf> or <userbufsize> are specified, both are required.
example:
CALL TIMER^DELETE( tcb, typ, subtyp, userbuf, userbufsize );
11-8
Nov-2006
ACI Worldwide Inc.
Timer Routines
TIMER^DELETE^1
TIMER^DELETE^1
Used to delete one or more timers from the timer list and also gives the user two
additional options concerning the deleted timers. The last parameter is for a user
proc that allows the user to process the data in the timer and/or the user proc can
specify whether to continue searching the timer table.
Syntax:
<error> := TIMER^DELETE^1( <tcb>, <typ>, <subtyp>, <userbuf>,
<userbufsize>, <user proc> );
where:
<error>, INT,
<tcb>, INT:ref,
<typ>, INT,
<subtyp>, INT,
<userbuf>, INT:ref,
<userbufsize>, INT,
This is a variable type procedure. Only <tcb> is required. The rest of the
parameters are optional. If no additional parameters are specified, no timer
will be deleted.
Nov-2006
ACI Worldwide Inc.
11-9
Timer Routines
TIMER^DELETE^1
If <userbuf> or <userbufsize> are specified, both are required.
The <user proc> should return true (-1) if the search for more timers is to
continue. It can be used to perform cleanup tasks when a timer is deleted.
Such tasks might include deallocating memory that was reserved by the given
timer.
example:
CALL TIMER^DELETE^1( tcb, typ, subtyp, userbuf, userbufsize, userproc );
11-10
Nov-2006
ACI Worldwide Inc.
Timer Routines
TIMER^EXPIRED
TIMER^EXPIRED
Checks if any timer has expired. Only the first timer is checked. If more than one
timer has expired, TIMER^EXPIRED must be called once for each timer that has
expired, until false(0) is returned.
Syntax:
<timer^addr> := TIMER^EXPIRED( <tcb>, <delete> )
where:
<timer^addr>, INT,
<tcb>, INT:ref,
<delete>, INT,
example:
DO
BEGIN
@timer := TIMER^EXPIRED( tcb, true );
IF @timer <> 0 THEN
BEGIN
! process expired timer
END;
END
UNTIL @timer = 0;
Nov-2006
ACI Worldwide Inc.
11-11
Timer Routines
TIMER^INIT
TIMER^INIT
Used to initialize the timer table. This proc must be called before using any of the
other timer procedures.
Syntax:
CALL TIMER^INIT( <tcb>, <timer^tbl> , <num^timers> , <user^buf^size> )
where:
<tcb>, INT:ref,
<timer^tbl>, INT:ref,
<num^timers>, INT,
<user^buf^size>, INT,
The user data area of the timers does not have to match for each timer type
and subtype. If multiple layouts are to be used, specify the word size of the
largest user data structure. The size specified here will be allocated at the end
of every timer structure to provide this user data area to each timer.
example:
CALL TIMER^INIT( tcb, timer^tbl, $occurs( timer^tbl ),
user^buf^size );
11-12
Nov-2006
ACI Worldwide Inc.
Timer Routines
TIMER^INSERT
TIMER^INSERT
Used to insert an interval timer in the active timer list.
Syntax:
<timer^addr> := TIMER^INSERT( <tcb>, <delay^time> , <typ> , <subtyp>)
where:
<timer^addr>, INT,
<tcb>, INT:ref,
<typ>, INT,
<subtyp>, INT,
example:
@timer := TIMER^INSERT( tcb, delay^time, typ, subtyp );
timer.userbuf := some^value;
OR
@user^area := @timer.userbuf;
! manipulate user^area structure
Nov-2006
ACI Worldwide Inc.
11-13
Timer Routines
Extended Memory Segment Timer Routines
timerx^def( * );
next;
exptime;
type;
subtype;
userbuf;
first^timer^addr;
free^timer^addr;
number^of^timers;
timer^depth;
max^timer^depth;
number^allocated;
alloc^block^size;
timer^size;
The userbuf element of the timerx^def structure locates a word address at the end of
each timer where user data can be placed. When timers are initialized, the word size
of the largest user data area is specified so that the timers are allocated in memory
with space at the end of each timer for a data structure of the developers choice.
The address of a particular timer is returned by each of the following procs:
FIND^SPECIFIC^TIMERX, TIMER^EXPIREDX, and TIMER^INSERTX. This
address can be used to locate the beginning of the userdata areas for application
specific purposes.
The user should modify no other area of the timer structure.
11-14
Nov-2006
ACI Worldwide Inc.
Timer Routines
Extended Memory Segment Timer Routines
To use these procs do the following:
1) Source in =ACIUTILS_UTILDEFS( timer^structs ) in your program where struct
templates are defined.
2) Declare timer control block (using TIMER^CONTROL^BLOCKX^DEF).
3) Declare the timer table large enough to contain the maximum number of timers,
plus any user data associated with timer elements. This timer table should be
allocated in an extended memory segment.
4) CALL TIMER^INITX before calling any other TIMER procedures.
Example:
LITERAL
timer^user^buf^lgth^l
num^of^timers^l
timer^entry^size^l
timer^tbl^limit^l
:= -1;
Nov-2006
ACI Worldwide Inc.
11-15
Timer Routines
Extended Memory Segment Timer Routines
timer^wait
:= next^expire^timex( tcb );
11-16
Nov-2006
ACI Worldwide Inc.
Timer Routines
DELETE^THIS^TIMERX
DELETE^THIS^TIMERX
Designed to be used after a call to timer^expiredx or find^specific^timerx, when the
location of the timer that is to be deleted is known.
Syntax:
<status> := DELETE^THIS^TIMERX( <tcb>, <timer> );
where:
<status>, INT,
<tcb>,INT .EXT:ref,
example:
@timer := find^specific^timerx( tcb, type^1 );
IF not DELETE^THIS^TIMERX( tcb, timer ) THEN
BEGIN
CALL log^message( timer^not^found );
END;
Nov-2006
ACI Worldwide Inc.
11-17
Timer Routines
FIND^SPECIFIC^TIMERX
FIND^SPECIFIC^TIMERX
Used to find the first timer (i.e., the one with the earliest expiration time), which
matches the calling parameters.
Syntax:
<timer^addr> := FIND^SPECIFIC^TIMERX( <tcb>, <typ>, <subtyp>,
<userbuf>, <userbufsize> )
where:
<timer^addr>, INT(32),
<tcb>,INT .EXT:ref,
<typ>, INT,
<subtyp>, INT,
<userbufsize>, INT,
This is an extensible type procedure. Only <tcb> is required. The rest of the
parameters are optional. If no additional parameters are specified, no timer
will be located.
If <userbuf> or <userbufsize> are specified, both are required.
example:
@timer := FIND^SPECIFIC^TIMERX( tcb, typ, subtyp, userbuf, userbufsize );
11-18
Nov-2006
ACI Worldwide Inc.
Timer Routines
NEXT^EXPIRE^TIMEX
NEXT^EXPIRE^TIMEX
Returns the time interval, in hundredths of a second, which must pass before the next
timer expires.
Syntax:
<wait^time> := NEXT^EXPIRE^TIMEX( <tcb> )
where:
<wait^time>, INT(32),
The value that is returned may be passed directly as the <wait time>
parameter in the AWAITIO[X] procedure.
<tcb>, INT .EXT:ref,
example:
file := -1;
wait^time := NEXT^EXPIRE^TIMEX( tcb );
CALL awaitio( file, , , , timer^wait );
Nov-2006
ACI Worldwide Inc.
11-19
Timer Routines
TIMER^ALLOCATEX
TIMER^ALLOCATEX
Due to the larger number of timers possible using extended memory it is not required
that all the timers be initialized by TIMER^INITX. If only a subset of timers are
initialized by TIMER^INITX, TIMER^ALLOCATEX can be called to allocate an
additional block of timers. If there are unallocated timers in the extended memory
table, and there are no available allocated timers for TIMER^INSERTX to use,
TIMER^INSERTX will automatically call TIMER^ALLOCATEX to build additional
timers in the available timer list.
Syntax:
CALL TIMER^ALLOCATEX( <tcb>, <num^to^allocate> )
where:
<tcb>, INT .EXT:ref,
<num^to^allocate>, INT(32),
example:
CALL TIMER^ALLOCATEX( tcb );
11-20
Nov-2006
ACI Worldwide Inc.
Timer Routines
TIMER^DELETEX
TIMER^DELETEX
Used to delete one or more timers from the timer list. Provides the user the ability to
pass a user defined procedure to perform additional cleanup related to the deleted
timers.
This extended memory timer routine combines functionality similar to
TIMER^DELETE and TIMER^DELETE^1. This extended memory version treats the
userproc in TIMER^DELETE^1 as an optional parameter. The userproc is only called
if it is passed as an argument. Otherwise, the functionality is similar to
TIMER^DELETE.
Syntax:
<error> := TIMER^DELETEX( <tcb>, <typ>, <subtyp>, <userbuf>,
<userbufsize>, <user proc> );
where:
<error>, INT,
<typ>, INT,
<subtyp>, INT,
<userbufsize>, INT,
Nov-2006
ACI Worldwide Inc.
11-21
Timer Routines
TIMER^DELETEX
<user proc>, INT,
This is an extensible type procedure. Only <tcb> is required. The rest of the
parameters are optional. If no additional parameters are specified, no timer
will be deleted.
If <userbuf> or <userbufsize> are specified, both are required.
The <user proc> should return true (-1) if the search for more timers is to
continue. It can be used to perform cleanup tasks when a timer is deleted.
Such tasks might include deallocating memory that was reserved for the given
timer.
example:
CALL TIMER^DELETEX( tcb, typ, subtyp, userbuf, userbufsize, userproc );
11-22
Nov-2006
ACI Worldwide Inc.
Timer Routines
TIMER^EXPIREDX
TIMER^EXPIREDX
Checks if any timer has expired. Only the first timer is checked. If more than one
timer has expired, TIMER^EXPIREDX must be called once for each timer that has
expired, until false (0) is returned.
Syntax:
<timer^addr> := TIMER^EXPIREDX( <tcb>, <delete> )
where:
<timer^addr>, INT(32),
<delete>, INT,
example:
DO
BEGIN
@timer := TIMER^EXPIREDX( tcb, true );
IF @timer <> 0d THEN
BEGIN
! process expired timer
END;
END
UNTIL @timer = 0d;
Nov-2006
ACI Worldwide Inc.
11-23
Timer Routines
TIMER^INITX
TIMER^INITX
Used to initialize the timer table. This proc must be called before using any of the
other timer procedures.
Syntax:
CALL TIMER^INITX( <tcb>, <timer^tbl> , <num^timers> , <user^buf^size>,
<alloc^block^size> )
where:
<tcb>, INT .EXT:ref,
<num^timers>, INT(32),
<user^buf^size>, INT,
<alloc^block^size>, INT(32),
This call initializes the timer control block, and calls TIMER^ALLOCATEX to
allocate all or a subset of the timers to create a pool of available allocated
timers. This allocation doesnt allocate memory; rather it adds timer elements
to a linked list of available timers. When there are no timer elements in the
linked list, TIMER^INSERTX will call TIMER^ALLOCATEX if the total number
of timers allocated is less than <num^timers>.
The <alloc^block^size> is intended to provide some flexibility when the
number of timers in use creates a performance issue by initializing them all up
front. For the use of fewer timers, it is most likely best to specify 1d and
allocate them all initially.
11-24
Nov-2006
ACI Worldwide Inc.
Timer Routines
TIMER^INITX
The user data area of the timers does not have to match for each timer type
and subtype. If multiple layouts are to be used, specify the word size of the
largest user data structure. The size specified here will be allocated at the end
of every timer structure to provide this user data area to each timer.
example:
CALL TIMER^INITX( tcb, timer^tbl, max^timers, user^buf^size, -1d );
Nov-2006
ACI Worldwide Inc.
11-25
Timer Routines
TIMER^INSERTX
TIMER^INSERTX
Used to insert an interval timer in the timer list.
Syntax:
<timer^addr> := TIMER^INSERTX( <tcb>, <delay^time> , <typ> , <subtyp>)
where:
<timer^addr>, INT(32),
<typ>, INT,
<subtyp>, INT,
example:
@timer := TIMER^INSERTX( tcb, delay^time, typ, subtyp );
timer.userbuf := some^value;
OR
@user^area := @timer.userbuf;
! manipulate user^area structure
11-26
Nov-2006
ACI Worldwide Inc.
Section 12
Miscellaneous Procs
BINARY^SEARCH
Searches a table for specified entry, returning the address within the table where a
match was found. The table and the key specifier may be in extended memory.
Also, the table is assumed to be in sorted ascending order.
Syntax:
<addr> := BINARY^SEARCH( <tbl> , <num^entries> , <entry^lgth> , <key> ,
<keyoff> , <keylgth> )
where:
<addr>, INT(32),
<tbl>, STRING.EXT:ref,
<num^entries>, INT,
<entry^lgth>, INT,
<key>, STRING.EXT:ref,
<keyoff>, INT,
<keylgth>, INT,
NOTE: Since extended pointer are always a byte address, we don't need to
left-shift or right-shift our addresses.
Nov-2006
ACI Worldwide Inc.
12-1
Miscellaneous Procs
BINARY^SEARCH
example:
STRING .ext tbl,
.ext key;
INT
num^entries,
entry^lgth,
keyoff,
keylgth;
INT(32)
addr;
addr
12-2
Nov-2006
ACI Worldwide Inc.
Miscellaneous Procs
CIRC^LEFT^SHIFT
CIRC^LEFT^SHIFT
Performs a circular left shift of the 64 bit value starting at a given parameter for a
specified length. As the bits are shifted out at the left of the field, they are shifted into
the right most bits of the field.
Syntax:
CALL CIRC^LEFT^SHIFT( <acc> , <num^bits> )
where:
<acc>, INT:ref:4,
<num^bits>, INT,
example:
INT
.array[ 0:3 ],
num^bits;
num^bits
:= 16;
CALL CIRC^LEFT^SHIFT( array, num^bits );
Nov-2006
ACI Worldwide Inc.
12-3
Miscellaneous Procs
CIRC^RIGHT^SHIFT
CIRC^RIGHT^SHIFT
Performs a circular right shift of the 64 bit value starting at "ACC". The procedure
performs the shifting in multiples of 4 bits. It receives as input the number of bits to
be shifted and the bit string to be shifted. The result of the operation is returned in
"ACC". The shift operation is "logical" rather than "arithmetic".
Syntax:
CALL CIRC^RIGHT^SHIFT( <acc> , <num^bits> )
where:
<acc>, INT:ref,
<num^bits>, INT,
example:
CALL CIRC^RIGHT^SHIFT( acc, num^bits );
12-4
Nov-2006
ACI Worldwide Inc.
Miscellaneous Procs
COMPLEMENT
COMPLEMENT
Takes an array and complements it.
Syntax:
CALL COMPLEMENT( <buf> , <cnt> )
where:
<buf>, INT:ref,
<cnt>, INT,
example:
CALL COMPLEMENT( buf , cnt );
Nov-2006
ACI Worldwide Inc.
12-5
Miscellaneous Procs
CONVERT^REC^ADDR^TO^REF^NO
CONVERT^REC^ADDR^TO^REF^NO
Converts the record's address to the record's reference number. The reference
number of a record is its relative position in an entry sequenced file where all records
are of equal ( fixed lengths ).
Syntax:
CALL CONVERT^REC^ADDR^TO^REF^NO( <rec^addr>, <ref^no> ,
<blk^lgth>, <blk^hdr^lgth>,
<rec^lgth> );
where:
<rec^addr>, INT(32): val
example:
LITERAL
INT(32)
blk^lgth
blk^hdr^lgth
rec^size
ref^no,
rec^addr;
= 4096,
= 20,
= $len( rec^def );
12-6
Nov-2006
ACI Worldwide Inc.
Miscellaneous Procs
CONVERT^REF^NO^TO^REC^ADDR
CONVERT^REF^NO^TO^REC^ADDR
Converts the reference number of a record to a record address that can be used to
position into the file and read the record. The reference number of a record is its
relative postion in an entry sequenced file where all records are of equal ( fixed
lengths ).
Syntax:
CALL CONVERT^REF^NO^TO^REC^ADDR( <ref^num>, <rec^addr> ,
<blk^lgth>, <blk^hdr^lgth>,
<rec^lgth> );
where:
<ref^num>, INT(32): val
example:
LITERAL
INT(32)
blk^lgth
blk^hdr^lgth
rec^size
ref^no,
rec^addr;
= 4096,
= 20,
= $len( rec^def );
Nov-2006
ACI Worldwide Inc.
12-7
Miscellaneous Procs
CURRENT^ADDR
CURRENT^ADDR
Returns the 'P' relative address of the caller, and is used mainly for logging errors
detected.
Syntax:
<stat> := CURRENT^ADDR( <e^reg> , <p^reg> )
where:
<stat>, INT,
<e^reg>, INT:ref,
<p^reg>, INT:ref,
example:
If a call to ASCII^INTEGER failed, there could be one
standard wlform:
wlform(conv^fail, "ASCII^INTEGER failed, location\C")
that can be used throughout the program, with the same
message number for logger:
INT
.ext e^reg,
.ext p^reg;
12-8
Nov-2006
ACI Worldwide Inc.
Miscellaneous Procs
DBL^OCTAL^WIDTH
DBL^OCTAL^WIDTH
Returns the number of character positions necessary to print the octal representation
of an INT(32) number, thus giving an alternate to zero suppression, using only those
bytes needed to print a number.
Syntax:
<width> := DBL^OCTAL^WIDTH( <val> )
where:
<width>, INT,
<val>, INT(32),
example:
Nov-2006
ACI Worldwide Inc.
INT
INT(32)
width;
octal^val;
octal^val
width
:= 7d;
:= DBL^OCTAL^WIDTH( octal^val );
12-9
Miscellaneous Procs
DBL^WIDTH
DBL^WIDTH
Returns the number of character positions necessary to print an INT(32) number,
thus giving an alternative to zero suppression, using only those bytes needed to print
a number.
Syntax:
<width> := DBL^WIDTH( <val> )
where:
<width>, INT,
<val>, INT(32),
example:
12-10
INT
INT(32)
width;
val;
val
width
:= 226d;
:= DBL^WIDTH( val );
Nov-2006
ACI Worldwide Inc.
Miscellaneous Procs
EDITLINENO
EDITLINENO
EDITLINENO places into a string array the character version of an EDIT file
sequence number sent as an argument. Since EDIT file sequence numbers are
placed into INT(32) variables any similar value can of course be converted.
Syntax:
CALL EDITLINENO( <outstr>, <seq^num> )
where:
<outstr>, STRING:ref:9,
<seq^num>, INT(32):val,
example:
STRING
INT(32)
.out^string[ 0:8 ];
seq^num;
seq^num
:= 12345d;
CALL EDITLINENO( out^string, seq^num );
Nov-2006
ACI Worldwide Inc.
12-11
Miscellaneous Procs
FUNCTION^KEY
FUNCTION^KEY
Returns a value from -16 to +16 for the values of the function keys or an error value.
Value 0 indicates that break was pressed. If an error occurs, it is added to 1000
before returning. This prevents errors between 1 and 16 being confused with valid
function keys. The parameter error contains the actual error number. Negative
numbers are returned for shifted function keys.
Syntax:
<key^num> := FUNCTION^KEY( <file^num>, <err> )
where:
<key^num>, INT,
<file^num>, INT,
<err>, INT:ref,
example:
INT
function^key^num,
file^num,
err;
function^key^num
12-12
Nov-2006
ACI Worldwide Inc.
Miscellaneous Procs
GET^NEXT^ARG
GET^NEXT^ARG
Makes it possible to obtain the next of a series of elements from an array, with any
specified field separator.
Syntax:
<addr> := GET^NEXT^ARG( <ptr>, <outbuf>, <lgth>, <delimiter> )
where:
<addr>, INT,
<ptr>, STRING:ref,
<outbuf>, STRING:ref,
<lgth>, INT:ref,
<delimiter>, STRING:value,
Nov-2006
ACI Worldwide Inc.
12-13
Miscellaneous Procs
GET^NEXT^ARG
examples:
STRING
INT
.str^array[ 0:10 ],
.output^array[ 0:3 ];
.addr,
lgth,
delimiter;
str^array[ 10 ]
lgth
delimiter
str^array
@addr
12-14
':='[ 0 ];
:= 11;
:= "#";
':=' "hi # bye #";
:= GET^NEXT^ARG( str^array,
output^array,
lgth, delimiter );
Nov-2006
ACI Worldwide Inc.
Miscellaneous Procs
MOTHER
MOTHER
Provides the process name or identification number of its creator and/or the creator's
program file name.
Syntax:
CALL MOTHER( <mom^name>, <mom^prog> )
where:
<mom^name>, INT:ref:4,
example:
INT
.mom^name[ 0:11 ],
.mom^prog[ 0:11 ];
Nov-2006
ACI Worldwide Inc.
12-15
Miscellaneous Procs
MSG^AGE
MSG^AGE
Returns the number of seconds that a message has been in our queue until we read
it.
Syntax:
<elapsed> := MSG^AGE( <msg^time> )
where:
<elapsed>, INT(32),
<msg^time>, INT:ref,
example:
INT(32)
INT
lgth;
.msg^time;
12-16
Nov-2006
ACI Worldwide Inc.
Miscellaneous Procs
OCTAL^WIDTH
OCTAL^WIDTH
Returns the number of character positions necessary to print the octal representation
of an octal number, thus giving an alternative to zero suppression, using only the
bytes needed to print a number.
Syntax:
<width> := OCTAL^WIDTH( <val> )
where:
<width>, INT,
<val>, INT,
example:
Nov-2006
ACI Worldwide Inc.
INT
width,
octal^val;
octal^val
width
:= 226;
:= OCTAL^WIDTH( octal^val );
12-17
Miscellaneous Procs
RANDOM
RANDOM
Accepts a double word "seed" and returns a double word random number. When the
seed for this call is the random number from the last call, the number generated does
not fall into a repeating pattern for several million calls.
Syntax:
CALL RANDOM( <num> , <seed> )
where:
<num>, INT(32):ref,
<seed>, INT(32):ref,
example:
INT(32)
random^num,
seed;
seed
:= 2389d;
CALL RANDOM( random^num, seed );
12-18
Nov-2006
ACI Worldwide Inc.
Miscellaneous Procs
SHA1^HASH
SHA1^HASH
This procedure generates a 20-byte hash value from an input string using the SHA-1
(Secure Hash Algorithm 1) function.
Syntax:
<stat> := SHA1^HASH ( <input^data>, <input^lgth>, <sha1^hash> )
where:
<stat>, INT,
<input-data>, STRING:ref
data to be hashed.
<input^lgth>, INT
<sha1^hash>, STRING:ref
example:
stat := SHA1^HASH ( input^data, input^lgth, sha1^hash );
Nov-2006
ACI Worldwide Inc.
12-19
Miscellaneous Procs
TRACK^LEN
TRACK^LEN
Calculates the length of a passed ABA formatted track.
Syntax:
<lgth> := TRACK^LEN( <trk> , <maxlgth> )
where:
<lgth>, INT,
<trk>, STRING:ref,
<maxlgth>, INT,
example:
12-20
STRING
INT
.trk[ 0:9 ];
max^lgth,
lgth;
trk
lgth
':=' ";1234567890123=9912
";
:= TRACK^LEN( trk, max^lgth );
Nov-2006
ACI Worldwide Inc.
Miscellaneous Procs
UT^FNAMECOLLAPSE
UT^FNAMECOLLAPSE
Works exactly like Guardian's FNAMECOLLAPSE except that if there is not an
expand system name on the returned external^name then it tries to put one there,
even if the volume name is 8 characters long. This means the length of the external
file name has to be 35 characters long instead of 34.
Syntax:
<retn^val> := UT^FNAMECOLLAPSE( internal^name , external^name )
where:
<retn^val>, INT,
<internal^name>, INT:ref,
<external^name>, STRING:ref,
example:
retn^val := UT^FNAMECOLLAPSE( internal^name,
external^name );
Nov-2006
ACI Worldwide Inc.
12-21
Miscellaneous Procs
WIDTH
WIDTH
Returns the number of character positions necessary to print a given integer value,
thus giving an alternative to zero suppression, using only the bytes needed to print a
number.
Syntax:
<width> := WIDTH( <val> )
where:
<width>, INT,
<val>, INT,
example:
12-22
INT
width,
val;
val
width
:= 1000;
:= WIDTH( val );
Nov-2006
ACI Worldwide Inc.