CDS087

Return File Information (deprecated)

Last Revised: 05/28/09

This called routine is used to return information about a file/program currently opened.  This program has been replaced by CDS187 and should not be used for new coding, but is still supported for existing code.

This routine should be used as opposed to the bbx FID() function since the contents of the FID() function can vary with operating system and version of business basic.  Using CDS087 makes the calling program hardware and operating system independent.

Calling Format:

CALL "CDS087", F, F1$, F2$, F3$, F4$, F[ALL], F5$, F6$, F7$

CDS087
Input Data Elements
F Device number of file, program, or device currently opened
Output Data Elements
F1$ Actual FID() function as provided by business basic
F2$ Data/Program files: file/program name less any prefix or node.

Devices: normalized device identification. Terminal and Ghost task devices will return a 4 character string of the format XYYY where X=T for terminals, G for ghosts, and YYY is a number from 000 to 999. No alphabetic characters are used.

F3$ File/Device type
DIRDirect Access Disc File
INDIndexed Disc File
SRTSort Disc File
SERSerial Disc File
PGMProgram
DEVDevice
DRYDisc Directory
STRString File
SKYSingle Key MKEYED file
MKYMulti-key MKEYED file
SELData File opened using SELECT verb
EPGEncrypted Program
PGnProgram of version n
EPnEncrypted Program of version n
???Other
F4$
Programs First Remark line
Data the file description from the file data dictionary (passed as null if there are no available devices)
XXSI50 files includes company name
F[ALL]
F[0] Last modification date, julian format
F[1] Keysize for DIR/SRT/SKY file
F[2] Non-program files: number of records defined program files: always zero
F[3] Non-program files: characters per record

program files: characters defined

F[4] SER - next available file index
F[5] file size in characters
F[6] MKY, SKY, DIR & SRT files: Number of records in use

 Indexed Files: Number of records in use based on convention that the first field of the first record contains the last index used.

Program Files: Number of characters in use Serial Files: Number of characters in use

F[7] % Full
F[8] Last modification time
F[9] Lock Flag:

Set to 0 if not locked

Set to 1 if locked

Set to 2 if F is negative indicating F1$ is directory entry to be used as input

F5$ fully specified path name
F6$ MKY key definition data from FIN().  Used when defining MKY files using CDS064 and the KGEN() function.
F7$ company code as derived from first two characters of file name after SMSDIR directory. This is useful for the newer 5 character file names used by programs, where the company code is not a part of the program name.
Special Calling Options:

Normally, the calling routine has the file or device opened to channel F and desires the output variables listed above. It is also possible to pass to CDS087 the disc directory entry F1$ as an input variable in order to obtain the other output variables. To do this, no file must be opened. Instead, pass F as -1, and F1$ as the directory entry to be decoded.

It is sometimes not necessary to obtain the file identification variable F4$. To bypass the logic used to obtain F4$ simply call CDS087 with a single blank for the F4$ variable.

Example: CALL "CDS087",1,"",F2$,""," ",F[ALL]. The blank will cause CDS087 to bypass the logic to obtain F4$. This will improve the speed of the routine and reduce the memory requirements.