Using Mainframe Access (MFA) - Micro Focus
Using Mainframe Access (MFA) - Micro Focus
Using Mainframe Access (MFA) - Micro Focus
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
<strong>Using</strong> <strong>Mainframe</strong> <strong>Access</strong> (<strong>MFA</strong>) from a COBOL program<br />
This article describes the methods necessary to access the services of <strong>Mainframe</strong> <strong>Access</strong> (<strong>MFA</strong>) to<br />
allow a COBOL application program on the PC to access resources on your mainframe system.<br />
The <strong>MFA</strong> command line can be called from a COBOL program by using a <strong>Micro</strong> <strong>Focus</strong> call-by-number<br />
function called X'91' function 35. The <strong>MFA</strong> command line function uses MFDAS.EXE and documented<br />
functions that have been included below. For this program to work, you must have a working <strong>MFA</strong><br />
client installed on the machine. The DISPLAY that is presented to the COMMAND LINE will be<br />
executed by MFDAS.EXE by the call. Note that the display does not include the MFDAS because it is<br />
passed in the COMMAND of the call. The MFDAS.EXE directory would need to be in the PATH<br />
environment variable for the execution to work.<br />
<strong>MFA</strong> requires a login to the mainframe. Should a login daemon not be currently running a GUI login<br />
screen will appear for the user to sign in with their mainframe sign on ID and Password.<br />
The following is a tested program sample:<br />
IDENTIFICATION DIVISION.<br />
PROGRAM-ID. TESTCLIX.<br />
ENVIRONMENT DIVISION.<br />
CONFIGURATION SECTION.<br />
SOURCE-COMPUTER. IBM-PC.<br />
OBJECT-COMPUTER. IBM-PC.<br />
DATA DIVISION.<br />
WORKING-STORAGE SECTION.<br />
01 RESULT PIC X COMP-X.<br />
01 FUNC PIC X COMP-X VALUE 35.<br />
01 COMMAND.<br />
05 LEN PIC X COMP-X VALUE 10.<br />
05 PGM PIC X(10) VALUE 'MFDAS.EXE'.<br />
PROCEDURE DIVISION.<br />
DISPLAY<br />
"IMPORT TEXT H:\customers\mfa\filename.dat FROM QSAM MFICWA.S<br />
- "YSCIN" UPON COMMAND-LINE<br />
CALL X'91' USING RESULT FUNC COMMAND<br />
IF RESULT = 0<br />
Display "IMPORT SUCCESSFUL"<br />
ELSE<br />
Display "IMPORT failed " RESULT<br />
END-IF.<br />
GOBACK.<br />
The following are excerpts from the stand-alone <strong>MFA</strong> product documentation.<br />
On return, Drag and Drop sets the COBOL RESULT variable. The following return-codes are<br />
produced:<br />
00 Successful call<br />
01 An error was returned from MFLSC<br />
14 The program MFLSC is missing<br />
15 Call to DFCONV failed<br />
48 The mainframe member is locked by another user<br />
49 A mainframe ABEND occurred<br />
50 A dynamic allocation error occurred when accessing a dataset<br />
51 An open error occurred on the mainframe<br />
52 An invalid request for a valid function was detected<br />
53 An I/O error has occurred on a mainframe dataset<br />
54 An invalid sub-code was given to the mainframe<br />
55 A load error on a program on the mainframe was detected<br />
Page 1 of 4
<strong>Using</strong> <strong>Mainframe</strong> <strong>Access</strong> (<strong>MFA</strong>) from a COBOL program<br />
56 A length error, at a record level, has been detected<br />
57 A general security error has been detected<br />
58 A hash code mismatch has been detected<br />
59 The remote execution failed<br />
60 The JES spool file is not an output file<br />
61 The JES spool file is not a held output file<br />
100 Syntax error in call<br />
125 Too many concurrent users are active<br />
139 The record length was too large<br />
218 The DCB is not supported. This is usually caused by trying to use RECFM=U<br />
219 The mainframe load libraries are not APF authorized<br />
220-241 Various SAF security return codes<br />
242 The component in use has not been activated on the mainframe<br />
243 Unable to write the specified file to the workstation<br />
244 Unable to read the specified file from the workstation<br />
245 The catalog search detected an error<br />
246 The catalog search did not yield any results<br />
247 The /F MFENDDRV* statement was not in FHREDIR.CFG<br />
248 The /F MFLSCDRV* statement was not in FHREDIR.CFG<br />
249 The file FHREDIR.CFG could not be located<br />
250 A communications failure occurred<br />
251 The file did not have a positive length<br />
252 An invalid mask was given<br />
253 The local access mask was not specified<br />
254 The local access mode was not set<br />
255 Invalid function was requested<br />
Importing Data<br />
You can import individual members, or a collection of members defined by a filter, from the JES<br />
spool, a partitioned dataset or source code control system or you can import entire QSAM, VSAM<br />
datasets, IMS databases or DB/2 tables with automatic data conversion to the appropriate <strong>Micro</strong><br />
<strong>Focus</strong> format. You may optionally specify a control file containing one or more commands and allow<br />
MFDAS to run them as a batch. To do this, place the commands in a control file of any name,<br />
without the preceding MFDAS parameter, then run MFDAS with the parameter @filename, where<br />
filename is the name of the control file.<br />
Text or binary transfers are possible. Use the BINARY or TEXT operand to override the default<br />
transfer type for the type. The default transfer type for PDS, Librarian, Panvalet, Endevor, or<br />
CCC/LCM, is TEXT. The default transfer type for QSAM is BINARY. VSAM, IMS and DB/2 cannot be<br />
overridden.<br />
The MEMBER parameter can specify a specific mainframe member name, or can include special filter<br />
characters to allow multiple imports to occur based on the special filter characters that you specify.<br />
These special filter characters are:<br />
• * means any characters may follow<br />
• ? means any character in this position<br />
• + means the character in this position must be non-blank<br />
• - means the character in this position must be blank<br />
• \ means the character in this position must be non-numeric<br />
• / means the character in this position must be numeric<br />
Page 2 of 4
<strong>Using</strong> <strong>Mainframe</strong> <strong>Access</strong> (<strong>MFA</strong>) from a COBOL program<br />
Import command examples:<br />
JES<br />
To import from the mainframe JES2 or JES3 spool:<br />
MFDAS IMPORT filename FROM JES JOB#####|filter<br />
PDS<br />
To import from a Partitioned data set:<br />
MFDAS IMPORT [BINARY | TEXT] filename FROM PDS pdsname MEMBER memname|filter<br />
Librarian<br />
To import from a Librarian data set:<br />
MFDAS IMPORT [BINARY | TEXT] filename FROM LIB libname MEMBER memname|filter<br />
Panvalet<br />
To import from a Panvalet dataset:<br />
MFDAS IMPORT [BINARY | TEXT] filename FROM PAN panname MEMBER memname|filter<br />
Endevor<br />
To import from an Endevor data set:<br />
MFDAS IMPORT [BINARY | TEXT] filename FROM END ENV 'env' SYS 'sys' SUB 'sub' MEMBER<br />
memname|filter TYPE memtype CCID ccid COMMENT user comment<br />
CCC/LCM<br />
To import from a CCC/LCM data set. If you wish to lock this member out, then specify the LOCK Y<br />
parameter.<br />
MFDAS IMPORT [BINARY | TEXT] filename FROM LCM lcmname SYSTEM systemid CONFIG configid<br />
MEMBER memname|filter TYPE memtype [LOCK y]<br />
In-House System<br />
To import from your own in-house source code control system dataset:<br />
MFDAS IMPORT [BINARY | TEXT] filename FROM IHS ihsdatasetname MEMBER memname|filter<br />
QSAM<br />
To import from a QSAM data set with automatic data conversion:<br />
MFDAS IMPORT [BINARY | TEXT] filename FROM QSAM qsamname<br />
VSAM KSDS<br />
To import from a VSAM KSDS data set with automatic data conversion and produce a variable<br />
length workstation indexed file. If you wish to produce a fixed length indexed file, then use KSDS-<br />
FIXED instead of KSDS.<br />
MFDAS IMPORT filename FROM KSDS vsamksdsname<br />
VSAM ESDS<br />
To import from a VSAM ESDS data set with automatic data conversion and produce a variable<br />
Page 3 of 4
<strong>Using</strong> <strong>Mainframe</strong> <strong>Access</strong> (<strong>MFA</strong>) from a COBOL program<br />
length workstation indexed file. If you wish to produce a fixed length indexed file, then use ESDS-<br />
FIXED instead of ESDS.<br />
MFDAS IMPORT filename FROM ESDS vsamesdsname<br />
VSAM RRDS<br />
To import from a VSAM RRDS data set with automatic data conversion and produce a variable<br />
length workstation indexed file. If you wish to produce a fixed length indexed file, then use RRDS-<br />
FIXED instead of RRDS.<br />
MFDAS IMPORT filename FROM RRDS vsamrrdsname<br />
IMS Database<br />
To import from an unloaded IMS database with automatic data conversion and produce a<br />
workstation PCIMS format database. Three additional parameters are available after the mainframe<br />
IMS unloaded datasetname field. These parameters are the required database name, location of<br />
segment name in the data record (relative to 1) and the location of the segment data in the data<br />
record (relative to 1). If the mainframe database has been unloaded using the <strong>Micro</strong> <strong>Focus</strong> PCIMS<br />
unload utility, then these three fields are not required, as they are automatically picked up from the<br />
mainframe unloaded dataset.<br />
MFDAS IMPORT filename FROM IMS imsunloadedname [databasename] [segmentnamelocation]<br />
[segmentdatalocation]<br />
DB/2 Table<br />
To import from an unloaded DB/2 table with automatic data conversion and produce a workstation<br />
XDB format table. Three additional parameters are required after the mainframe DB/2 unloaded<br />
datasetname field. These parameters are the required location, authid, and table name. The<br />
mainframe table must have been unloaded into a sequential file using the DSNTIAUL DB/2 unload<br />
utility. The table must exist and the SQLWizard must be available on the path.<br />
MFDAS IMPORT filename FROM DB2 db2unloadedname location authid tablename<br />
NOTE: The <strong>MFA</strong> product and the example shown here are designed only to be used in a mainframe<br />
application offload development environment utilizing our <strong>Mainframe</strong> Express product. The <strong>MFA</strong><br />
product is not designed to be used in any production environment or application.<br />
Page 4 of 4