|
Code changes |
|
|
In order to run on a UNIX system programs coming from the mainframe environment must be modified. Even if there are only few changement in the source code, it is very important to understand them.? Changements may concern:
File declaration While using xvsamRts, only little changes to COBOL coding are required because, by utilizing the EXTFH (External File Handler) feature offered by MicroFocus COBOL, xvsamRts offers the possibility to access flat UNIX as well as XVSAM files at the same time, through the standard COBOL READ, WRITE, START etc. instructions. The required changes in user programs regards :
But you are not involved in the modification process, as all required programs' changes are dynamically performed by the xcob procedure. It means that original code coming from mainframe remains mainly the same. SELECT clause modification In the original mainframe environment, the internal file name used in the program code is linked to the cluster name using the features of the JCL language, DD for MVS or OS/390 and DLBL for VSE. More exactly the name specified in the ASSIGN TO of a SELECT clause is used to link logical name and cluster name. In the XFRAME environment, the assignment is made using the EXTERNAL clause: the assignment is done by an environment variable defined and exported in the environment where programs run. Therefore the following ASSIGN TO syntax will be required: SELECT <internal-filename> ASSIGN TO EXTERNAL <external-filename> Where <internal-filename> is the logical name of the file used in the COBOL code, and <external-filename> is the cluster name of the data set : both them will passed to the environment variable used in the corresponding JCL to link the logical with the cluster name. The following sample shows modifications applied on a COBOL source directly imported from mainframe : Mainframe version INPUT-OUTPUT SECTION. XFRAME Version INPUT-OUTPUT SECTION. The association between the two entities logical-name and cluster-name takes place in the setenv or export statement, which substitutes itself to the DD or DLBL card: setenv dlbl_ID2MOVM "MY.CLUSTER.MOVM,cat=CAT1,type=flat" export dlbl_ID2MOVM="MY.CLUSTER.MOVM,cat=CAT1,type=flat" ACCEPT FROM DATE /CURRENT-DATE Depending on the system and COBOL versions, programs coming from mainframe normally get the system date using ACCEPT <var> FROM DATE or MOVE CURRENT-DATE statements. MicroFocus COBOL supports these statements, but, in order to grant the possibility to run programs with dates different from the system one, the following ACCEPT <varname> FROM DATE and MOVE CURRENT-DATE TO <varname> must be substituted by: DISPLAY “UNIX_CURRENT_DATE” UPON ENVIRONMENT-NAME Depending on the originating COBOL version, batch programs coming from VSE or MVS normally get the system date using the ACCEPT <varname> FROM DATE - in case of COBOL II - or MOVE CURRENT-DATE - in case of ANS74 or COBOL I - instructions. The format of the <varname> field, where the date is returned by the system differs in the two cases: if the MOVE CURRENT DATE statement is used, the date is 8 bytes long, and it has format DD/MM/YY (in case the European notation for the date has been chosen on your system); if the ACCEPT FROM DATE has been used the returned date has format YYMMDD in an unsigned elementary numeric data item six digits in length. MicroFocus COBOL is able to support both these two statements, but, in order to give the user the possibility to run his programs with a date that can differ from the current date, the ACCEPT <varname> FROM DATE and MOVE CURRENT-DATE TO <varname> are substituted with: DISPLAY “UNIX_CURRENT_DATE” UPON ENVIRONMENT-NAME being <varname> a COBOL variable initialized by default with the system date, but that you can modify within one or more procedure. Therefore, in dependence by which statement have you used in your programs to catch the date, the setting of the UNIX-CURRENT-DATE environment variable will be carried out differently in the XRUN batch manager. The following sample shows modifications applied on a COBOL II program coming from mainframe: Mainframe version PROCEDURE DIVISION. XFRAME version PROCEDURE DIVISION. |