HiLMAs reference
Back

Input/Output instructions

Next

FOPEN

FOPEN numfile[,DDNAME=,TYPE=,ACCESS=,MODE=[,RESET=]]

[,LRECL=][,FN=,FT=,FM=,RECFM=][,CMSDEV=]

 

Description

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:

Parameter specifications

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  

Examples

 


Back Start Next
INPUT Top FCLOSE