FOPEN numfile[,DDNAME=,TYPE=,ACCESS=,MODE=[,RESET=]]
[,LRECL=][,FN=,FT=,FM=,RECFM=][,CMSDEV=]
This statement opens (or defines) a file: numfile is a whatever constant number from 1 to 20 that will be associated to this file; other parameters are environment dependent:
DDNAME= is the logical name of the file in MVS/TSO (8 characters max) or VSE (7 characters max);
is also used in CICS whereas is not used in CMS; can be a constant enclosed in quotes or also a string variable containing the ddname value.TYPE= is the file type: a fixed word that can be :
SAM (for a sequential file) in MVS, TSO, VSE
KSDS, ESDS, RRDS (for VSAM files) in MVS, TSO, VSE or CICS;
in VSE can also be PRT or PUN for a printer file or a punch file, and in this case ddname must be of the type 'SYSnnn' where 'nnn' is the hexadecimal number that identify the wanted spool file to Power
in CMS, if used, can be only PRT or PUN
LRECL= is the record length; can be an integer constant or variable; mandatory only for SAM files
ACCESS= is the access mode of the file: can be DIR (direct) or SEQ (sequential); is used by VSAM files; is not used with sequential files, in CICS or in CMS
MODE= can be INPUT or OUTPUT; in CMS can be also NEW or REPLACE
FN=, FT=, FM=, RECFM= are CMS only parameters and are Filename, Filetype, Filemode and Record Format (F or V); if Filemode is omitted, 'A1' is assumed.
CMSDEV= is CMS only parameter and can be used to open special files such: PRT, PUN (these can be opened also using TYPE= parameter), RDR (virtual reader in input), TAPn (n-th virtual tape), CONS (virtual console), vdev (hexadecimal address of a virtual device attached to the virtual machine)RESET=NO/YES is VSAM only and generally is not used (NO is the default)
$RCFILE contains return code of the open process, but not for SAM files that don't return any code;
for VSAM files also $RCVSAM is filled and in CICS are also filled $RCVSAM and $RESP.Note that:
all values are constant words, unless DDNAME, FN, FT, FN that can be a string variable and LRECL that can be an integer variable- in CICS environment shouldn't be necessary to open files because files are usually opened starting CICS or by system administrator; in this release of Hilmas files are really opened by the program (if file is closed) and to do this a CICS 3.1 or higher is required; if you want deny the use of a file to a Hilmas program you must disable the file; if you have a lower release of CICS you can use the special parameter ACCESS=DUMMY to avoid commands not supported by CICS in the compiled program (this parameter is not tested): in this case FOPEN statement do nothing in run time, but prepares the environment for the correct use of the other file instruction in compile time.
Parameter Name Mode Type coding Remark 1 numfile Input numeric constant from 1 to 20 DDNAME= Input String C or X or const. TYPE= Input fixed word SAM, VSAM type, PRT, PUN ACCESS= Input fixed word DIR or SEQ MODE= Input fixed word INPUT or OUTPUT LRECL= Input Integer F or H or const. CMS files only: FN= Input String C or X or const. FT= Input String C or X or const. FM= Input String C or X or const. default A1 RECFM= Input fixed word can be F or V CMSDEV= Input fixed word
Back | Start | Next |
INPUT | Top | FCLOSE |