The following CBL_* library functions commonly found in other compiler's runtime support are supported by Elastic COBOL
Function | Parameters | Return |
Description |
---|---|---|---|
CBL_ALLOC_MEM |
MEM-POINTER, |
0 OK, |
Dynamically allocate memory of MEM-SIZE bytes and set the COBOL pointer variable MEM-POINTER to the allocated. |
CBL_AND |
SOURCE, |
void |
Perform a bit-wise AND operation between two arguments, updating the second with the result. |
CBL_CHANGE_DIR |
PATH |
0 OK, -1 invalid |
Change the current working directory for the duration of this program to the given PATH (PIC X(n)). |
CBL_CHECK_FILE_EXIST |
PATH, |
01 stats. |
Check whether a file path exists and, if so, set the STATS parameter with statistics about it. |
CBL_CLOSE_FILE |
HANDLE, OPER |
0 OK, |
Close a byte stream (if OPER is 1) that was previously opened with CBL_OPEN_FILE (which returned a HANDLE). |
CBL_COPY_FILE |
SOURCE, DEST |
0 OK, |
Copy a file given by the path SOURCE to a new file given by DEST. |
CBL_CREATE_DIR |
PATH |
0 OK, |
Create any and all directories in the given PATH. |
CBL_CREATE_FILE |
PATH, |
0 OK, |
Create a file with the given PATH and make it "r" (readable), "w" (writable) or "rw" (both). |
CBL_DELETE_DIR |
PATH |
0 OK, |
Remove the directory, which must be empty, given by PATH. |
CBL_DELETE_FILE |
PATH |
0 OK, |
Remove the file given by PATH. |
CBL_EQ |
SOURCE, |
void |
Compare each byte in SOURCE and TARGET variables up to size LENGTH, storing a 0 (unequal) or 1 (equal) in each TARGET byte after comparison. |
CBL_ERROR_PROC |
OPER, |
0 OK, |
Install (if OPER is 1) or de-install (if OPER is 0) a COBOL program name PROCNAME as a routine to be called upon error. |
CBL_EXIT_PROC |
OPER, |
0 OK, |
Install (if OPER is 0) or de-install (if OPER is 1 or 3) a COBOL program name PROCNAME as a routine to be called upon program exit. |
CBL_FLUSH_FILE |
HANDLE |
0 OK, |
Flush an (output) byte stream that was previously opened with CBL_OPEN_FILE (which returned a HANDLE). |
CBL_FREE_MEM |
POINTER |
0 OK, |
Free memory allocated through CBL_FREE_MEM. POINTER argument is set to the null pointer. |
CBL_GET_OS_INFO |
PARAM-BLOCK |
01 param-block. 0 OK, |
Return various information about the operating system environment in which this program is running. |
CBL_GET_PROGRAM_INFO | FUNCTION, PARAM-BLOCK, BUF, BUF-LEN |
01 param-block. 0 OK, |
Return information about a function given by FUNCTION COMP-X value (0) the current function, (1) the named function in a PIC X(n) after the the COMP-X value, (2) the calling program. Given information is returned in the PARAM-BLOCK and the function name queried is returned in BUF of length BUF-LEN |
CBL_IMP | SOURCE, TARGET, LENGTH |
0 OK, |
Carries out a bitwise "logical implies" operation between two arguments of length LENGTH, storing the result of the IMP in each byte of TARGET. |
CBL_JOIN_FILENAME |
SPLIT-JOIN-PARAM, |
0 OK, |
Forms a filename by joining together its component parts; that is, the pathname, basename and extension. Operation is under control of an extraordinarily complex structure SPLIT-JOIN_PARAM. |
CBL_LOCATE_FILE |
USER-FILE-SPEC, |
01 actual-file-spec 0 OK, |
Find a file based on certain criteria |
CBL_NOT |
TARGET, |
void |
Perform a bit-wise NOT operation on the TARGET bytes of given LENGTH of the TARGET parameter, updating the parameter TARGET. |
CBL_OPEN_FILE |
PATH, |
HANDLE |
Open the file given by PATH as readable (ACCESS="r"), writable (ACCESS="w") or both (ACCESS="rw"), ignoring DENY and setting the fixed block size to BLOCKSIZE if non-0. Return a HANDLE used in other CBL_*_FILE operations. |
CBL_OR |
SOURCE, |
Perform a bitwise "OR" operation on the first two arguments of length LENGTH, updating the TARGET bytes with the result of each operation. |
|
CBL_READ_DIR |
PATH, |
Set the PATH parameter to the name of the current user's directory (Java USER.DIR property) and its LENGTH |
|
CBL_READ_FILE |
HANDLE, |
Read the file with the handle previously returned with the CBL_FILE_OPEN library call, beginning at OFFSET position within the file, a sequence of bytes of length LENGTH, the result of which is stored in BUF. FLAGS=128 indicates to return the length of the file in LENGTH. |
|
CBL_RENAME_FILE |
SOURCE, |
0 OK, 1 Failed |
Rename a file name SOURCE as new name TARGET |
CBL_TRANSFORM |
INPUT, ERR, ["CONV(EBC2ASC|ASC2EBC)"], ["FROMCHAR(inputcharset)")], ["TOCHAR(outputcharset)"], ["XFDXML(/path/toxfdxml)"] |
INPUT - COBOL field, ERR - COBOL field PIC X(256) Return values :- 0 OK, 1 Exception 2 Error |
Transform the input field data from either EBCDIC to ASCII or vice versa. The default transformation is from EBCDIC to ASCII . The default input charset is IBM1047 and the default output charset is ISO-8859-1. When data types varies in the transform field due to REDEFINES usage, use the XFDXML param to specify the path to the XFDXml file |
CBL_TOLOWER |
TARGET, |
0 OK, |
Translate the parameter character values to lower case characters, return the changed buffer in TARGET. |
CBL_TOUPPER |
TARGET, |
0 OK, |
Translate the parameter character values to upper case characters, return the changed buffer in TARGET. |
CBL_WRITE_FILE |
HANDLE, |
0 OK, |
Write a record in the file with the handle previously returned with the CBL_FILE_OPEN library call, beginning at OFFSET position within the file, a sequence of bytes of length LENGTH, from the data located in BUF. FLAGS are ignored. |
0 Comments