MVS COBOL conversion - Contents


Part_0 - Introduction & Summary of Major Benefits

Part_1 - Operating Instructions for the Test/Demo files supplied
- Do these 1st to ensure the conversion tools work correctly at your site
- helps you to understand the conversion process
- scripts to reconvert & recompile 1 copybook/program or all in subdir
- helps you to understand the conversion process

Part_2 - COBOL conversions Explained
- Operating Instructions to Convert & Compile COBOL programs
- demo programs illustrated Before & After conversion
  car100.cbl - sample COBOL program to list Name & Address demo file
  jar100.ksh - JCL/script to execute COBOL program car100.cbl
- copybooks inserted by COBOL conversion for Mainframe/Unix differences
  unixwork1.cpy - copybook inserted at WORKING-STORAGE
  unixproc1.cpy - copybook inserted at the end of the program
  testunix1.cbl - COBOL program to demo unixwork1/unixproc1
  unixwork3.cpy - WORKING-STORAGE version for AIX COBOL (vs Micro Focus)
  unixproc3.cpy - PROCEDURE DIVISION version for AIX COBOL (vs Micro Focus)

Part_3 - COBOL conversion Problems & Solutions
- modifying COBOL programs to ACCEPT RUNDATE different from system date
- providing various DATE formats via unixwork1.cpy/unixproc1.cpy
- PARM data (passing data from the JCL to the COBOL program)
- replacing assembler subroutines with C subroutines
- compile/link COBOL programs with called programs in lib archive
- Test File Locking for Micro Focus COBOL (demo car150.cbl)
- Demo calling a script from a COBOL program
- get system date & store value in environment-variable RUNDATE
- then call a script which will display the value of RUNDATE
- demos that environment values can be passed from parent to child
- But not from child to parent (child cant affect parent environment)

Part_4 - Testing & Debugging Aids
- animation, uvhd, cobmap, cross-references, etc
- many other scripts & utilities valuable during conversions
- several of these can be run using supplied test files
- get familiar with these, so you will know when they can save you time
- Micro Focus COBOL Error codes listed here for your convenience

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

MVSCOBOL.doc Converting Mainframe COBOL to Unix/Linux

MVS COBOL conversion - Contents


Part_5 - 'profile's, Control Files, & scripts to convert & compile
- Micro Focus COBOL options file & File Handler config file
- control files control the behavior of conversion tools
- supplied versions are tuned for the Test/Demo conversions
- you may have to modify for Your conversions

Part_6 - Converting YOUR Mainframe COBOL (vs supplied test/demos)
- Directory Design & Operating Instructions for YOUR conversions
- Improving your JCL conversion, by modifying the control files, etc
- scripts to reconvert & recompile 1 copybook/program or all in subdir

Part_7 Introduction to Micro Focus 'screen programs'
- demo screen Display/Accept techniques using nameadrs1.cbl
- can use to replace a few CICS programs for primarily batch migrations
- download sample program from https://www.uvsoftware.ca/nameadrs1.cbl
 Directories & Files required for demo
 Setup directories, download files, and compile
 Execute the program & inspect results
 Extract valid records from the Indexed file
 Indexed file uvhd (hexdump) showing deleted & valid records
 program listing of sample screen program 'nameadrs1.cbl'
- so you can see screen display/accept techniques before downloading

Part_8 - test IDXFORMAT3 & IDXFORMAT8 data file compatibility between COBOL
and the 'ux' utilities (uxcp,uxsort,uxcopy,uxqrpg).

Part_9 - Considerations for MF Net Express on Windows/SFU

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

MVSCOBOL.doc - Converting Mainframe COBOL to Unix/Linux - Contents

Documentation for All Mainframe Conversions

Here is a brief review of the documentation relevant to mainframe conversions & accessible on the UV Software web site (www.uvsoftware.ca).

JCLcnv1demo.htm - MVS JCL Conversion to Korn shell scripts

MvsJclPerl.htm - MVS JCL Conversion to Perl scripts


VSEJCL.htm - VSE JCL Conversion

MVSCOBOL.htm - VSE COBOL Conversion <-- This Document

VSECOBOL.htm - MVS COBOL Conversion
Note
  • not a lot of differences between MVSCOBOL & VSECOBOL
  • main difference is the JCL examples (VSE JCL vs MVS JCL)
  • MVS conversion jobs identified by suffix '5' or '51'
  • VSE conversion jobs identified by suffix '4' or '41'

MVSDATA.htm - Convert MVS EBCDIC Data to ASCII, preserving packed fields

VSEDATA.htm - Convert VSE EBCDIC Data to ASCII, preserving packed fields

Copyright 1993-2013, UV Software Inc.

Owen Townsend, UV Software, 4667 Hoskins Rd., North Vancouver BC, V7K2R3

 Tel: 604-980-5434 Fax: 604-980-5404

mailto:owen@uvsoftware.ca https://www.uvsoftware.ca

COBOL source code recovery


 https://www.source-recovery.com
 ==============================

I recommend Source Recovery LLC if you need to recover COBOL source code from object code. They are reasonably priced at $250 per program.

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

Part_0 Converting Mainframe COBOL to Micro Focus on Unix/Linux/SFU

Converting Mainframe COBOL to Micro Focus - Overview

  1. Converting COBOL programs requires fewer changes than converting the JCLs to scripts or the DATA files from EBCDIC to ASCII, but the Vancouver Utility COBOL conversions will save you a lot of manual editing. This document will also alert you to a number of other important considerations (summarized below).

  2. The converter uses a Search/Replace table that you may modify to reduce the compile failure rate. Older COBOL programs often use words that are now reserved in newer versions of COBOL compilers. Adding entries to the Search/Replace table solves this problem automatically for both copybooks & programs.

  3. These procedures are designed for sites wishing to convert hundreds or thousands of COBOL programs in the most efficient manner possible. The mass conversions & mass compiles of all programs in the directory takes only a few minutes.

  4. The mass compile scripts capture the error reports & a script is provided to print out the 1st page of each compile failure report. Use these reports as your guide to mass edit sessions & then rerun the mass compiles until you have eliminated the failures.

  5. Programs are compiled to .int's & .idy's to allow using the world famous 'animator' provided by Micro Focus COBOL (allows you to step thru your program line by line, displaying variables of interest). Note that the JCL/scripts are converted with animation in mind. To animate just 'export ANIM=+A' from your shell prompt. When you run the JCL/script, each COBOL step will be animated, just zoom thru any preceding steps until you reach the problem step.

  6. Part_2 will illustrate C subroutines to replace assembler subroutines.

  7. Cross-References of COBOL programs/copybooks & JCL/scripts. I suggest you print the cross-references, see JCLcnv3aids.htm#Part_1 You might find it useful to also list the following: Inventory control lists of all filenames & line counts, Content listing of JCL/scripts before & after conversion, Copybook layout maps, COBOL File info reports,& JCL Job-Flow reports. These listings should be run after you have transferred & converted the COBOL & JCL, but before you begin testing & debugging. House these reports in 3-ring binders with index tabs for easy access during testing & debugging.

  8. Job-Flow reports extract File Info from both JCLs & COBOL programs. One line is printed for each datafile in each step. From the JCL we show: Step#, Program-name, DLBL-name1,& DLBL-name2. From the matching COBOL program, we show: file Organization, Access-mode, Open-mode(I/O/E), Record-size,& Copybook-name. These reports are your essential guide to testing & debugging.

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

0A2. Converting Mainframe COBOL to Micro Focus - Overview

  1. Directory Design. A lot of time and effort was invested to ensure the directory design would accommodate multiple separate systems, but allowing for interconnections. Program libraries and data are in separate file systems, which are each subdivided by the various applications.

  2. Environmental variables RUNDATA & RUNLIBS allow programmers to operate on test data & test libraries while production personnel operate on production data & production libraries. RUNLIBS is defined in the profiles to control the PATH to JCL/scripts. All converted JCL/scripts call a common function (jobset51) which performs a 'change directory' to $RUNDATA at the beginning of the script. All file accesses are then relative to $RUNDATA which is either test data or production data depending on the user profile. This facility is vital if production & development are on the same machine, but still useful for separate machines. For example, different programmers can use different sets of data files &/or libraries.

  3. Console Logging. This is a VITAL feature to replace the console logging systems provided by proprietary mainframe systems. Console Logging uses the Unix/Linux 'script' command inserted at the end of the profile to create a date/time stamped console log file which captures all console I/O until the operator logs off. Console log files must be processed (to remove screen control codes) before being viewed or printed & this is accomplished automatically when the user logs off & back on. He may then use the logview script to view or print the latest (or earlier) log file. See the sample console log created when the conversion test/demo jobs are executed later on page '1N3'. Or see console logging in ADMjobs.htm. Note that you must uncomment the last 6 lines of the profile to activate console logging. See the profile listed at ADMjobs.htm#1C3. You must also setup a subdir in /home/appsadm/log1,2,3 matching userid. Console logging should be mandatory for operators, but can be optional for programmers (highly recommended for testing).

    CICS conversion to Micro Focus Screen programs

Please see www.uvsoftware.ca/mvscobol.htm#Part_7 which documents using Micro Focus screen programs for data entry, browse, update. If you have Micro Focus COBOL, you can download the nameadrs1.cbl demo program & test it at your site.

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

0A3. Converting Mainframe COBOL to Micro Focus - Overview

COBOL, JCL,& DATA conversions harmonized

Note that the batch conversions do all components (JCL,COBOL,DATA). The JCL, COBOL,& DATA conversions are harmonized, for example:

  1. JCL converter loads SYSIN instream data into a file for Micro Focus COBOL SYSIN/INDD option. Since Micro Focus COBOL on unix/linux has no instream data concept, the 'ACCEPT's from SYSIN would otherwise have to be changed to 'READ's from a file & a 'SELECT' stmnt inserted for the file. In fact the COBOL conversion has this option if you wish to use it. See doc/example at www.uvsoftware.ca/mvscobol.htm#3A1

  2. The DATA file conversions have an option to convert fixed 80 column files (originally cards wayback in the good old days) to 'text' files. IE - LineFeeds are inserted (after the last non-blank), which means they can be edited & printed with the unix/linux editors (vi, lp, etc). This is a huge advantage for all those parameter files, date cards, etc.

  3. The COBOL converter has a corresponding option to change the SELECT stmnt default of 'ORGANIZATION RECORD SEQUENTIAL' (fixed lth, no LineFeeds) to 'ORGANIZATION LINE SEQUENTIAL' (LineFeeds after last non-blank).

  4. JCL converter generates export for RUNDATE COBOL converter inserts code to accept date from environmental variable

  5. JCL converter generates exports for PARM data COBOL converter accepts the data via the environmental variable see doc/example at www.uvsoftware.ca/mvscobol.htm#3C1 see sample program car120 at www.uvsoftware.ca/mvscobol.htm#3C3

  6. the COBOL converter inserts 'copy unixwork1' at working storage 'copy unixproc1' at the end of the program,& 'perform unixproc1' at procedure division. This code helps provide the solution to several conversion problems (RUN dates, PARM data, etc). See unixwork1 & unixproc1 listed at www.uvsoftware.ca/mvscobol.htm#2E3 & 2E3.

  7. You may well be able to use these 2 inserted copybooks to solve other problems that arise during your conversion. For example if you had many database programs that now require a CONNECT statement for unix/linux you could code it in 'unixproc1' with any data fields in 'unixproc1'.

    COBOL conversion & compile times

Note that all COBOL programs can be converted with 1 command and 1000 programs would probably take about 1/2 hour.

We also have a script to compile all programs with 1 command and that would probably take about 1/2 hour for 1000 programs.

The script captures error reports & we use them to fine tune search/replace tables in the converter for reserved word differences or enhance the converter for site dependent coding habits.

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

Part_1 Converting Mainframe COBOL to Micro Focus COBOL on Unix/Linux/SFU


1A1. COBOL Conversion Introduction & Overview
- for the supplied test/demo programs & JCLs

1B1. Directory Design for UV test/demo JCL Conversion

1C1. Preparation for the test/demo conversions
- setup user mvstest (or vsetest)
- copy supplied test/demo files over from /home uvadm

1D0. Scripts to Convert All COBOL copybooks & programs
- cnvMF51Acpy for 'All copybooks' & cnvMF51A for 'All programs'
- BUT, we recommend the 'step by step' Op. Instrns. for your 1st convert
- alternatives for AIX COBOL cnvAIXcpyA & cnvAIXcblA

1D1. step by step Op. Instrns. to Convert the Demo COBOL 'CopyBooks'
1D2.  step by step Op. Instrns. to Convert the Demo COBOL 'Programs'
1D3.  Operating Instructions to Compile under Unix &/or Linux
1D4.  Alternatives for AIX COBOL: cnvAIXcpy1/cnvAIXcbl1 & aixcblA/aixcbl1
1D5.  Sample output of 'mfcblA' script to compile ALL COBOL programs
- captures 1st few errors for compile failues
- alternative 'aixcblA' for AIX COBOL
1D6.  Compile Error Analysis, report 1st few errors for compile failures
- operating instructions for uvcopy jobs cblerrs1 & cblerrs2
1D7.  Sample reports for COBOL compile failures
- table summary by Major-Reason for failure
- table summary by Detail-Reason for failure
1D8.  Sample report to be used as guide for program corrections
- sorted by failure reason showing progam name & 1st error

1D9. Operating Instructions to Compile under Windows with SFU/UWIN/CYGWIN

1E1. Operating Instructions to Convert the Test/Demo JCLs to scripts

1F1. Operating Instructions to Execute the Test/Demo JCL/scripts
- expected console displays

1G1. scripts to reconvert copybooks & programs - 1 at a time
- cnvMF51cpy for 1 copybook & cnvMF51 for 1 program
- alternatives for AIX COBOL cnvAIXcpy1 & cnvAIXcbl1

1G2. scripts to reconvert copybooks & programs - All in directory
- cnvMF51Acpy for All copybooks & cnvMF51A for All programs
- alternatives for AIX COBOL cnvAIXcpyA & cnvAIXcblA

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

1A1. Converting Mainframe COBOL to Micro Focus COBOL

COBOL Conversion test/demo Presentation Plan

Part 1 will illustrate the COBOL conversion Operating Instructions, using a set of supplied test/demo files (COBOL programs, copybooks, JCL's,& data files).

You can run the conversions for both COBOL programs & JCL, compile the programs, and then execute the converted JCL/scripts to verify that the converted COBOL programs execute successfully.

Note that the primary documentation for JCL conversions is found in other documents JCLcnv1demo.htm & VSEJCL.htm.

Here in MVSCOBOL.htm, we are primarily concerned with COBOL conversions but we will include a very brief listing of the JCL conversion Operating Instructions. For the full story, please see JCLcnv1demo.htm or VSEJCL.htm.

Also note that there are some differences in the COBOL conversions Operating Instructions between MVS & VSE systems. For example the primary conversion job for VSE is 'cnvMF4' & for MVS it is 'cnvMF5'. IE - the digit '4' indicates VSE & the digit '5' indicates MVS.

COBOL conversions Explained in Parts 2 & 3

This Part 1 presents focuses on the COBOL conversion Operating Instructions. Please see Part_2 & Part_3 for illustrations & explanations of the various changes made in the COBOL programs.

See Part 6 for your COBOL conversions

Parts 1,2,& 3 illustrate COBOL conversions using test/demo files supplied by UV Software, and using a directory structure designed for test/demo convenience.

Part_6 will help you to design a directory structure that will be better for your testing & production. Please use Part_6 as your guide to converting your own COBOL programs.

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

1B1. Converting Mainframe COBOL to Micro Focus COBOL

Directory-Design for UV test/demo Conversion

 /home/mvstest         <-- setup user 'mvstest' & copy subdirs from uvadm/mvstest
 :-----testlibs
 :     :--*--Csub        - C subroutines for COBOL programs
 :     :--*--cbl0        - COBOL programs ('*' means files present)
 :     :-----cbl1        - cleaned up, cols 1-6 & 73-80 cleared, etc
 :     :-----cbl2        - cnvMF5 converts mainframe COBOL to MicroFocus COBOL
 :     :-----cbl3        - sysin1 converts instream ACCEPTs to READs from a file
 :     :-----cbl4        - sysout1 converts DISPLAY on SYSOUT to WRITE to a file
 :     :-----cbls        - copy here (standard source library) before compiling
 :     :-----cblst       - cobol source listings from compiles
 :     :-----cblx        - compiled COBOL programs (.int's)
 :     :--*--parm0       - control cards & includes (SORT FIELDS, etc)
 :     :-----parms       - control cards with 73-80 cleared
 :     :-----cpy0        - for COBOL copybooks
 :     :-----cpy1        - cleaned up, cols 1-6 & 73-80 cleared, etc
 :     :-----cpy2        - cnvMF5 converts mainframe COBOL to MicroFocus COBOL
 :     :-----cpys        - copy here (standard copybook library)
 :     :--*--ctl         - conversion control files (jclunixop5, datafiles51)
 :     :-----errs        - JCL converter writes ERROR reports here
 :     :--*--jcl0        - test/demo JCLs supplied
 :     :-----jcl1        - intermediate conversion 73-80 cleared
 :     :-----jcl2        - PROCs expanded from procs
 :     :-----jcl3        - JCLs converted to Korn shell scripts
 :     :-----jcls        - copy here manually 1 by 1 during test/debug
 :     :-----maps        - 'cobmaps' record layouts generated from copybooks
 :     :-----pf          - uvcopy jobs to replace utilities (easytrieve,etc)
 :     :--*--proc0       - test/demo PROCs supplied
 :     :-----procs       - will be merged with jcl1, output to jcl2
 :     :-----rpts        - for optional statistics reports
 :     :-----sf          - for misc scripts you may wish to write
 :     :--*--sfun        - korn shell functions (jobset51,exportgen0,etc)
 :     :-----tmp               - tmp subdir used by various conversions
 :     :-----xref              - cross-references (see Part_9)
 :--*--testdata          - test/demo data files supplied
 :     :--*--ap          - Accounts Payable
 :     :--*--ar          - Accounts Receivable
 :     :--*--gl          - General Ledger
 :     :-----jobtmp      - temporary files for SYSIN instream data
 :     :     :----030926 - jobtmp subdir created in jobset51 (script line 9)
 :     :-----sysout      - SYSOUT printer files
 :     :-----tmp         - tmp subdir for uvsort & misc use
 :     :-----wrk         - interstep temporary work files

These directories are supplied as part of the Vancouver Utility package. They allow you to test/demo the conversion procedures, to give you a clear understanding of the process, before converting your own COBOL & JCL.

You will be later instructed to setup a test/demo userid/login 'mvstest' and copy all above subdirs from /home/uvadm/mvstest to /home/mvstest before running the various conversion jobs.

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

1B2. Converting Mainframe COBOL to Micro Focus COBOL

Notes re: test/demo files provided

The sub directories illustrated on the previous page are included on the Vancouver Utility distribution media and after installation will be contained within /home/uvadm/mvstest.

You will be instructed to setup a test/demo userid/login 'mvstest'. Then copy the subdirs from /home/uvadm/mvstest to /home/mvstest. Please do not run tests within /home/uvadm because new distributions of Vancouver Utilities would destroy your test results.

If you have just installed the package, you can run the test/demo conversion procedures (starting on page '1C1') and verify that you get the same results listed here. If you have not yet purchased the package, you are invited to send samples of your COBOL programs & JCLs to UV Software for conversion & return.

Note that the directory design listed here is for test/demo convenience only. The recommended directory design for your own testing & production is illustrated later starting on page '6A1'.

RUNLIBS & RUNDATA

RUNLIBS & RUNDATA are critical environmental variables defined in the profile. See the recommended profiles for this test/demo listed at ADMjobs.htm#1B2. RUNLIBS=$HOME/testlibs and RUNDATA=$HOME/testdata. Since $HOME=/home/mvstest for test/demo the result will be: 'RUNLIBS=/home/mvstest/testlibs' and 'RUNDATA=/home/mvstest/testdata'.

RUNLIBS is used in the PATH to define where the JCL/scripts are to be found. RUNDATA is used in the jobset51 function called at the beginning of each script to perform a change directory to the data files super directory.

All data files are addressed relative to RUNDATA, which allows us to easily switch between test data & production data simply by changing the value of RUNDATA. This is done most reliably by providing different profiles to the programmers & the production personnel.

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

1C1. Converting Mainframe COBOL to Micro Focus COBOL

Preparations to convert test/demo COBOL & JCL

These operating instructions will convert all files in a directory, outputting to a 2nd directory. The instructions for all files are actually simpler than for 1 file at a time & almost as fast (especially for the test/demo files).

mvstest or vsetest

After installing the Vancouver Utilities as per install.htm, the test/demo files may be found within 2 subdirs (/home/uvadm/mvstest & /home/uvadm/vsetest). Use whichever is approriate for you, but this documentation will refer primarily to 'mvstest' (please make mental substitutions as approriate).

setup user/login & modify profile


 #1. Setup a user login account for the test/demo. Please make it 'mvstest'
     (or 'mvstest'), so the test/demo conversions will work without having to
     modify any control files (profile, jobset51, jclunixop51, etc).
     Be sure to specify the Korn shell. If not provided with your system
     you may download from www.kornshell.com.

 #2. Append the supplied profile (from /home/uvadm/env/stub_profile) to the
     unix/linux system profile (/home/mvstest/.bash_profile). See instructions
     at the beginning of the supplied profile listed at ADMjobs.htm#1B2.

 #3. Modify the supplied profile appropriately for your Unix/Linux site.
     If you have followed the recommendations so far, I think the only changes
     required (for the test/demos) is to define your laser printer & modify
     COBDIR (depending on where you installed COBOL). Find the following lines
     in the supplied profile.

     export UVLPDEST="-dlp0"           <-- change 'lp0' to your laser printer
     =======================
     export UVLPDEST="-dLPT1"          <-- for Windows SFU
     =======================

     export COBDIR=/home/cobadm/cobol  <-- change for your site
     ================================

 #4. Logout & back in to activate the new profile

login: mvstest --> /home/mvstest

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

1C2. Converting Mainframe COBOL to Micro Focus COBOL

copy demo files to your mvstest home dir


 #5. Copy the supplied test/demo files from uvadm to your new home directory.

 #5a. cp -r /home/uvadm/mvstest/* /home/mvstest
      =========================================
      Your home directory should then contain the subdirs & files listed
      on page '1B1'. The more relevant subdirs for the COBOL conversions are:
      cbl0,cbl1,cbl2,cbls,cpy0,cpy1,cpy2,cpys,cblx,ctl,& Csub.
Note
  • Before you begin these procedures, be sure you understand the
    directory structure illustrated on page '1B1'

stay in the home directory

You must stay in the home directory (/home/mvstest or /home/vsetest). The scripts are designed to work with the various subdirs below you so they can copy between the subdirs. Examine your files by addressing thru 1 level of subdir (vi jcl1/xxx). Do not waste time by changing into the subdirs, doing 1 vi, & changing back.

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

1D0. Converting Mainframe COBOL to Micro Focus

There are scripts to that perform all steps of the conversions (cnvMF51Acpy for copybooks & cnvMF5 for programs), BUT we recommend you use the 'step by step' method for your first conversion, so you can detect any errors easier.

See the 'step by step' Operating Instructions starting on page '1D1'.

reconvert COBOL copybooks - All in directory


 cnvMF51Acpy all    <-- reconvert All copybook in directory
 ============        cpy0 --> cpy1 --> cpy2 --> ?--> cpys
                   - prompts to continue at various points
 --> copy UNIXWORK1 & UNIXPROC1 from /home/uvadm/mvstest/cpy0 ?
 --> y <-- reply y if 1st time conversion of this directory

--> cleanup complete, enter to convert --> y <-- reply y to continue

 --> copy All copybooks from cpy2 to cpys
 --> y <-- reply 'y' if OK to overwriting prior versions
         - when enhancements are made to COBOL converter & search/replace tables
         - before many copybooks have been modified/tested/debugged
 --> n <-- reply 'n' if you have spent a lot of time modifying copybooks in cpys

reconvert & recompile COBOL - All programs in directory


 cnvMF51A all    <-- reconvert All programs in directory
 ===========        cbl0 --> cbl1 --> cbl2 --> cbl3 ?--> cbls
                  - prompts to continue at various points
 --> cleanup complete, enter to convert
 --> y <-- reply y to continue
 --> copy All programs from cbl2 to cbls & recompile ?
 --> y <-- reply 'y' if OK to overwrite prior versions & recompile all
         - when enhancements are made to COBOL converter & search/replace tables
         - before many programs have been modified/tested/debugged
 --> n <-- reply 'n' if you have spent a lot of time modifying programs in cbls

Alternative for AIX COBOL


 cnvAIXcpyA all   <-- convert copybooks for AIX COBOL
 ===============

 cnvAIXcblA all    <-- convert COBOL programs for AIX COBOL
 ==============

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

1D1. Converting Mainframe COBOL to Micro Focus COBOL

step by step Operating Instructions

We recommend the step by step method for your 1st conversion. When you understand these conversions, it is more convenient to use the scripts provided (cnvMF51cpy/cnvMF51Acpy for copybooks,& cnvMF51/cnvMF51A for programs). Alternatives for AIX COBOL: cnvAIXcpy1/cnvAIXcbl1 & cnvAIXcpyA/cnvAIXcblA

See the scripts summarized on page '1G1' & '1G2'. See the scripts listed on pages '5C1' & '5C2'.

Converting Mainframe COBOL CopyBooks to Unix/Linux

First we will convert the CopyBooks, then the COBOL Programs (on the next page). Our test/demo mainframe copybooks are stored in subdir 'cpy0'. The instructions in Part 3 of MVSCOBOL.doc recommended the following procedure:

 cpy0--------->cpy1---------->cpy2--------->cpys
      cleanup       convert        copy(cp)

 #1. Cleanup copybooks from mainframe (may have extraneous CR's from FTP)
     - remove CR's, clear cols 1-6 & 73-80, translate to lower (not in quotes)
     - shorten text back to last non-blank, ensure output filenames in lowercase
     - cpy0 filenames UPPER case indicates mainframe,
       but all subsequent subdirs must have filenames in lowercase

 #1. uvcopyx cleanup cpy0 cpy1 uop=q0i7c5e15g8j1k1l1n1s8t1,arg1=.cpy
     ===============================================================
Note
  • See page CNVaids.htm#2D1 for explanations of the options coded above.
  • You only need 's8g8n1' for these demo copybooks.

 #2.  uvcopy cnvMF5,fild1=cpy1,fild2=cpy2,fili3=ctl/cnvcob5.tbl,uop=q0i7m2l0
      ======================================================================
            - convert COBOL CopyBooks for Unix/Linux Micro Focus compiler

 #3.  cp cpy2/* cpys        - copy converted copybooks to standard library
      ==============
Note
  • For the demo copybooks, only the 1st step above is required so we could
    skip steps 2 & 3 and simply copy cpy1 to cpys.

       cp cpy1/* cpys       <-- alternative to steps #2 & #3 above
       ==============

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

1D2. Converting Mainframe COBOL to Micro Focus COBOL

Convert ALL COBOL programs - Overview

These instructions will convert & compile ALL programs in the directory. Three demo programs (CAP100, CAR100,& CGL100) are supplied in subdir cbl0. The conversions & compile progress thru several subdirs as follows:

 cbl0------->cbl1------>xref/sort------->cbl2[-*->cbl3]----->cbls-------->cblx
  #1.cleanup  #2.Id OLS files  #4.convert     #5/6  #7.copy     #8.compile

[-*->cbl3] is optional conversions for sysin & sysout (see Notes below)

step#1 - cleanup code

step 2&3 - Identify Org Line Seqntl files

The COBOL converter (cnvMF5) provides option 'l1' to lookup an indexed file to identify printer files as 'ORGANIZATION LINE SEQUENTIAL' on 'select' stmnts.

Option 'l1' identifies files as 'OLS' if they have 'advancing' on any 'write's, or if the record-size is 133 for outputs, or 80 for inputs.

If disabled (l0) the converter would use a table of keywords commonly used in printer & card filenames (print,report,rpt,card,etc).

'uvcopy cobfil55' scans all COBOL programs looking for OLS criteria and writes a file (xref/cobfil55a) to identify these files keyed by programname & filename. 'uvsort' is then used to sort & load these records into an indexed file (xref/cobfil55I) for lookup by 'uvcopy cnvMF5'.

See steps #2 & #3 on the next page (required for option 'l1')

step 5&6 - optional replacements for SYSIN & SYSOUT

MicroFocus COBOL has options INDD & OUTDD to cause 'ACCEPTs from SYSIN' & 'DISPLAYs upon SYSOUT' to use external files defined by exports for SYSIN & SYSOUT. Please see the options file ctl/cobdirectives on page '5D1' & a test/demo program & JCL begining on page '2F1'.

For customers that do not have MicroFocus COBOL, the Vancouver Utilities includes uvcopy utility jobs 'sysin1' & 'sysout1' which will insert file definitions into the COBOL source programs.

sysin1 will convert 'accepts from sysin' to 'reads' from a real file with external name SYSIN. sysout1 will convert 'displays upon sysout' to 'writes' to a real file with external name SYSOUT.

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

1D3. Converting Mainframe COBOL to Micro Focus COBOL

Convert ALL programs with option l1 for ORG LINE SEQNTL


 #1. uvcopyx cleanup cbl0 cbl1 uop=q0i7c5e15g8j1k1l1n1s8t1,arg1=.cbl
     ===============================================================
     - cleanup mainframe code, remove CRs, clear cols 1-6 & 73-80, etc

 #2. uvcopy cobfil55,fild1=cbl1,filo2=xref/cobfil55a,uop=q0i7,rop=r0
     ===============================================================
     - scan all programs looking for 'write advancing's
     - create sequential file of file types keyed by program + filename

 #3. uvsort "fili1=xref/cobfil55a,rcs=100,typ=LST,filo1=xref/cobfil55I,typ=ISF\
             ,key1=0(44),isk1=0(44),del1=0(1):*"
     ==========================================================================
     - sort & load sequential file into indexed file for lookup by cnvMF5

 #4. convert mainframe COBOL to Micro Focus COBOL

 #4a. uvcopy cnvMF5,fild1=cbl1,fild2=cbl2,fili3=ctl/cnvcob5.tbl\
     ===========================================================
             ,fili4=xref/cobfil55I,uop=q0i7m1l1
             ==================================

 #4b. uvcopy cnvMF5   <-- easy alternative (files & options default as above)
      =============

optional sysin1 & sysout1


 #5.  uvcopyx sysin1 cbl2 cbl3 uop=q0i7    <-- optional, see NOTE below
      =================================
            - convert ACCEPT's from control streams to READ's from a file

 #6.  uvcopyx sysout1 cbl3 cbl4 uop=q0i7   <-- optional, see NOTE below
      ==================================
            - convert DISPLAY's upon SYSOUT to WRITE's to a file

Optional steps #5 & #6 are not required for Micro Focus COBOL using options INDD & OUTDD. See the 'cobdirectives' file listed on page '5D1'. You can omit #5 & #6 for the demos provided here in Part_1.

copy & compile


 #7. copy converted programs to subdir 'cbls' for compile script (mfcblA).
     (alternative 'aixcblA' for AIX COBOL)

 #7a. cp cbl2/* cbls  - copy from cbl2 if SYSIN/SYSOUT replacements NOT required
      ==============  - use this for the demos provided here in Part_1.

 #7b. cp cbl4/* cbls  - copy from cbl4 if SYSIN/SYSOUT replacements ARE required
      ==============

 #8. mfcblA all      - compile all programs for unix/linux
     ==========        (input source from cbls & output .int/.idy to cblx)

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

1D4. Converting Mainframe COBOL to Micro Focus COBOL

Alternative for AIX COBOL


 #1. cnvAIXcpyA all <-- convert copybooks for AIX COBOL
     ===============

 #2. cnvAIXcblA all  <-- convert COBOL programs for AIX COBOL
     ==============

Alternative for AIX COBOL


 #3. aixcblA all          <-- compile ALL programs for AIX COBOL
     ===========

 #3a. aixcbl1 program.cbl  <-- compile any 1 program for AIX COBOL
      ===================

compile called programs & archive for linking AIX COBOL

The compile scripts for Micro Focus compile only to a .int (interpretive) vs linked to an executable. Any called programs will be handled OK at execution time.

But the scripts for AIX COBOL do compile & link to an executable. Any called programs must be archived and provided to the AIX compile/link step. See documentation at MVSJCLtest2.htm#4I3

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

1D5. Converting Mainframe COBOL to Micro Focus COBOL

COBOL Compile Error reports

Here is a sample console log from 'mfcblA' (compile all programs in directory).


 #8. mfcblA all      - compile all programs, input from subdir cbls, output to
     ==========        subdir cblx: .int, .idy, .err,& .cbl (copy for animation)

mfcblA started 050317:1236 start compile of: car100.cbl

#compile #1 - car100.cbl start compile of: car120.cbl

#compile #2 - car120.cbl start compile of: car130.cbl

#compile #3 - car130.cbl start compile of: car200.cbl

#compile #4 - car200.cbl start compile of: car300.cbl

#compile #5 - car300.cbl start compile of: cgl100.cbl

#compile #6 - cgl100.cbl start compile of: cgl200.cbl

#compile #7 - cgl200.cbl start compile of: cpy100.cbl

 #compile #8 - cpy100.cbl
 *   8-S*****************************                                   (   0)**
 **    Unknown COPY file paymas.cpy specified
 **    Unknown COPY file paymas.cpy specified
 * 256-S***********                                                     (   1)**
 **    Preceding record has zero length
     18 fd  nalist record contains 120 characters.
 * 205-S**                                                              (   1)**
 **    RECORD missing or has zero size
 #compile #8 - cpy100.cbl - *FAILED*
 *** 1 compiles failed, of 8 attempts of 8 total ***
 programs compiled from cbls to cblx
 copylibs=/home/mvstest/cpys:/cpys:/cpys
 compile options file=/home/mvstest/ctl/cobdirectives
 mfcblA started 050317:1236, ended 050317:1236
Note
  • The 1 compile failure is intentional to show you the error report
  • error reports are captured in the compiler output directory
  • the error report for program cpy100.cbl would be cblx/cpy100.err

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

1D6. Converting Mainframe COBOL to Micro Focus

printing compile failure reports

The 'mfcbl1' & 'mfcblA' compile scripts leave the .err reports in the 'cblx' output directory. You can use the 'uvlpd1p' script to print the first page of each .err file in the cblx subdir as follows:


 #9. uvlpd1p cblx .err      <-- print 1st page of all .err reports
     =================

Compile Error Summaries

There could be a lot of errors on the 1st mass compile after conversion. 'cblerrs1' & 'cblerrs2' are provided to extract only the 1st few lines from each .err file into 1 file & to create table summary counts of errors by failure reason.

Please see more details on page '6H4' and sample reports on page '6H5', but here is a brief summary of the operating instructions:


 #10. uvcopy cblerrs1[,fild1=cblx,filo1=errs/cblerrs1.rpt]
      ====================================================
      - extract 5 lines of each .err file to summary file errs/cblerrs1.rpt

 #10a. uvcopy cblerrs1  <-- Easier Alternative (files default as shown above)
      ===============

 #11. uvcopy cblerrs2[,fili1=errs/cblerrs1.rpt,filo1=errs/cblerrs2.rpt\
                      ,filo2=errs/cblerrs2a.tbl,filo3=errs/cblerrs2b.tbl]
      ===================================================================
      - sort by failure reason & create summary tables

 #11a. uvcopy cblerrs2  <-- Easier Alternative (files default as shown above)
       ===============

 #12a. uvlp12 errs/cblerrs2a.tbl <-- print table summary counts by failure reason
       =========================   - summary by MAJOR reason for failure
                                     (ex: copybooks not found 1 line vs multiple)

 #12b. uvlp12 errs/cblerrs2b.tbl <-- print table summary counts by failure reason
       =========================   - DETAIL for each failure reason
                                     (shows al copybooks missing re sum count)

 #12c. uvlp12 errs/cblerrs2.rpt  <-- print detail report sorted by failure reason
       ========================

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

1D7. Converting Mainframe COBOL to Micro Focus

Here are sample reports created by the jobs documented above:


 #10. uvcopy cblerrs1   <-- generate failure reports (unsorted)
 #11. uvcopy cblerrs2   <-- generate failure reports (sorted) + summary tables

 #12a. uvlp12 errs/cblerrs2a.tbl <-- print summary by failure Major-Reason
       =========================

compile failure MAJOR-REASON summary table

 cblerrs2 2010/01/12 compile fail major reason summary table errs/cblerrs2a.tbl
 tbl#001 pg#001     -argument-
 line#  count    %  compile fail major reason
    1        1   2  **
    2        1   2  ** Boundary violation. Process
    3        1   2  ** Character other than *, D,
    4        3   7  ** Continuation character expe
    5        2   5  ** DEPENDING missing
    6        1   2  ** Data item too long
    7        1   2  ** Invalid operand
    8        2   5  ** Literal is numeric - treate
    9        1   2  ** Numeric literal expected
   10        2   5  ** PROCEDURE DIVISION missing
   11        5  12  ** Period missing. Period assu
   12       12  30  ** Unknown COPY file             <-- see DETAIL below
   13        1   2  ** Unrecognized phrase in SELE
   14        2   5  ** Unsigned numeric field. Sig
   15        4  10  ** User-name not unique
            39*100   *TOTAL*

 #12b. uvlp12 errs/cblerrs2a.tbl <-- print summary by failure Detail-Reason
       =========================

compile failure DETAIL-REASON summary table

   12        5  12  ** Unknown COPY file          e212015b.cpy
   13        2   5  ** Unknown COPY file          e212057b.cpy
   14        1   2  ** Unknown COPY file          e212085b.cpy
   15        2   5  ** Unknown COPY file          e212137b.cpy
   16        1   2  ** Unknown COPY file          e212817b.cpy
   17        1   2  ** Unknown COPY file          e231013b.cpy

Note that for the DETAIL-REASON report, we are showing only the difference. All failures due to 'Unknown COPY book' are summarized on 1 line in the Major-Reason report, but expanded to show the missing copybook name in the Detail-Reason report.

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

1D8. Converting Mainframe COBOL to Micro Focus

program failure report - sorted by reason

Use this report 'errs/cblerrs2.rpt' as your guide to corect program errors.

'errs/cblerrs2.rpt' includes 5 lines for each compile failure, showing you the program name & the 1st error in the program. The 1st error often causes all remaining errors, so I recommend you fix only the 1st error & recompile to get a new failure report.


 #12c. uvlp12 errs/cblerrs2.rpt <-- print program report sorted by failure reason
       ========================
 #Compile#=0093 Program=e212233c.cbl Lines=3371 TotalSeq#=2 FailReasonSeq#=1
   5442     move t-gl (8) to ib-200-1-cd-gl.
 ** Boundary violation. Processed as written.
 cob32: error(s) in compilation: e212233c.cbl
 ~~
 #Compile#=0146 Program=e212520c.cbl Lines=8749 TotalSeq#=3 FailReasonSeq#=1
   68275    move mp-f062-0-clas-ind-ap to work-clas-ind.
 ** Character other than *, D, /, -, or $ found in column 7. Blank assumed.
 *1001-E                                                                (   0)**
 ~~
 #Compile#=0199 Program=e212648c.cbl Lines=3267 TotalSeq#=4 FailReasonSeq#=1
   4511            display "RECORD 1 ABSENT AU F-CREDIT-TAXES E212945
 ** Continuation character expected. End of literal assumed.
 cob32: error(s) in compilation: e212648c.cbl
 ~~
 #Compile#=0207 Program=e212661c.cbl Lines=7264 TotalSeq#=5 FailReasonSeq#=2
   5907               display "RECORD 1 ABSENT AU F-CREDIT-TAXES E212945
 ** Continuation character expected. End of literal assumed.
 cob32: error(s) in compilation: e212661c.cbl
 ~~
 #Compile#=0290 Program=e212840c.cbl Lines=1313 TotalSeq#=6 FailReasonSeq#=3
   2961                      " MP-F075-0-MAT2-K " "
 ** Continuation character expected. End of literal assumed.
 cob32: error(s) in compilation: e212840c.cbl
 ~~
 #Compile#=0277 Program=e212815c.cbl Lines=3648 TotalSeq#=7 FailReasonSeq#=1
   1922                    indexed by idx-i-ni.
 ** DEPENDING missing
 ~~
 #Compile#=0286 Program=e212827c.cbl Lines=3308 TotalSeq#=8 FailReasonSeq#=2
   1809                                          indexed by idx-i-ni.
 ** DEPENDING missing
 ~~
                    - - - about 200 lines omitted - - -
Note
  • report above sorted by failure reason, with blank lines between groups
  • option to stop print for reason groups (default 30)
  • fix high volume failure reasons first
    (perhaps by modifying search/replace table ctl/cnvcob5.tbl)

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

1D9. Converting Mainframe COBOL to Micro Focus

Note re MicroFocus COBOL

You must of course have MicroFocus COBOL installed to compile & execute the COBOL programs, but if you do not, you can still do everything except the 'mfcblA' compiles above.

For the 'mfcblA' COBOL compiles to work, you will probably have to modify the COBDIR definition in the profile, depending on where COBOL is installed at your site. The supplied profile (listed beginning on page '5A1'), defines COBDIR as follows:


 export COBDIR=/home/cobadm/cobol
 ================================

compiling under SFU/UWIN/CYGWIN on Windows


 #6a. mfnxcblA all   - compile all programs to .int/.idy for SFU/UWIN/CYGWIN
     =============     (input source from cbls & output .int/.idy to cblx)

 #6b. mfnxcblB all   - compile all programs to executables for SFU/UWIN/CYGWIN
     =============     (input source from cbls & output .exe's to cblx)

COBOL compile scripts are different since the MicroFocus COBOL compiler is different (Server Express for Unix/Linux vs Net Express for Windows). The script to compile 1 program at a time is 'mfcbl1' for unix/linux, and 'mfnxcbl1' for SFU/UWIN/CYGWIN (or 'mfnxcbl2' to compile to executables). See listings on pages '5E2' & '9C3'.

COBOL compile console logs

 mfnxcblA started 040609:1549
 MicroFocus Net Express V4
 Version 4.0.38 Copyright (C) 1984-2003 MicroFocus International Ltd.
 * Checking complete with no errors - starting code generation
 * Generating car100
 * Data:        2000     Code:        1424     Literals:         484
 #compile #1 - car100.cbl
 MicroFocus Net Express V4
 Version 4.0.38 Copyright (C) 1984-2003 MicroFocus International Ltd.
 * Checking complete with no errors - starting code generation
 * Generating car200
 * Data:        1824     Code:        1624     Literals:         520
 #compile #2 - car200.cbl

2 programs compiled from cbls to cblx 0 compiles failed, of 2 attempts mfnxcblA started 040609:1549, ended 040609:1549

Note
  • see more detail in Part_9 about using Net Express on Windows/SFU

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

1E1. Converting Mainframe COBOL to Micro Focus COBOL

Converting the test/demo JCL

Before we can test/execute our converted demo COBOL programs, we must of course convert our demo JCL. The primary documentation for JCL conversions is found in JCLcnv1demo.htm & VSEJCL.htm, but here is a shortened version without explanations or illustrations.

cleanup mainframe JCL, PROCs,& Control Cards

The 1st 3 procedures will cleanup the demo mainframe code, clearing cols 73-80, translating filenames to lower case,& assigning filename extensions (.jcl or .prc or nothing).


 #1a. uvcopyx cleanup jcl0 jcl1 uop=q0i7g8n1,arg1=.jcl  <-- cleanup mainframe JCL
      ================================================
      - strip any CR's, clear cols 73-80,& shorten back to last nonblank
      - ensure output filenames are translated to lower case
      - assign filename extension '.jcl'

 #1b. uvcopyx cleanup proc0 procs uop=q0i7g8n1,arg1=.prc  <-- cleanup PROCs
      ===================================================
      - strip any CR's, clear cols 73-80,& shorten back to last nonblank
      - ensure output filenames are translated to lower case
      - assign filename extension '.prc'

expand PROC's & SLI's in all JCL


 #2.  jclpx51 jcl1 jcl2 procs sli1
      ============================
      - copy all jcl from jcl1 to jcl2,
      - expanding procs from arg3 & SLIs from arg4

 #2a. jclpx51 jcl1 jcl2 jcl1 jcl1
      ===========================
      - use this command if JCL, PROCs,& SLIs are all in 1 library

Creating - Data control file


 #3.  uvcopy jcldata51,fild1=jcl2,filo2=ctl/datajcl51
      ===============================================
      - generate Data control file (extracts filenames & types form JCL)
      - may add record-size & indexed file keys to improve conversions

 #3a. uvcopy jcldata51   <-- easier alternative (files default as shown above)
      ================

The next step is the actual JCL conversion to unix/linux scripts. The conversion also depends on 2 vital control files in subdir ctl See listings of ctl/jclunixop51 at JCLcnv1demo.htm#12A1 & ctl/datajcl51 at JCLcnv2real.htm#3B3. You will not have to modify for these test/demos, but you will later for your own JCL conversions.

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

1E2. Converting Mainframe COBOL to Micro Focus COBOL

Operating Instructions - Convert ALL JCLS in directory


 #4. jclxx51 jcl2 jcl3   - convert all JCL in jcl2 to scripts in jcl3
     =================

'jclxx51' is a script that executes the 'jclunix51' conversion program for each file found in input subdir & copy results to output subdir. jclxx51 requires control files: ctl/jclunixop51, ctl/datafiles51,


 #5. cp jcl3/* jcls      - copy all converted JCL/scripts to subdir jcls
     ==============        (since jcls is in the PATH, but not jcl3)
Note
  • This is done only for the test/demos, You should NEVER do this
    for your conversions, testing,& production because:
  1. If you need to reconvert (after improving tables in jclunixop51), the converter converts all JCL from jcl2 to jcl3 (never to jcls). Then you will manually copy desired jobs from 'jcl3' to 'jcls'.

  2. This protects you from destroying jobs in 'jcls', which may have had considerable effort invested in debugging & manual improvements.

  3. Copying 1 job at a time as we test/debug also provides with a means to track our progress - just listing the contents of jcls shows us the jobs already tested & debugged.

    Convert 1 job at a time

Normally you would convert all JCL's in the directory. Converting 1 job at a time might be used to re-convert new jobs brought over from the mainframe. A script is provided to perform all steps with 1 command. As an example, here are the conversion instructions for demo job 'jar100'.


 #1.  jcl2ksh51 JAR100.jcl       <-- convert 1 JCL at a time (for MVS)
      ====================

 #2.  cp jcl3/jar100.ksh jcls    <-- copy converted script to execution subdir
      =======================

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

1F1. Converting Mainframe COBOL to Micro Focus COBOL

Operating Instructions to Execute Demo JCL/scripts & COBOLs

Now we are ready to execute the demo JCL/scripts & COBOL programs. Note that RUNLIBS & RUNDATA (vital environmental variables in the profile) control which libraries are searched & which data directories will be accessed. The following illustrates only the subdirs that are actually required for the demo JCL/script execution and omits the various conversion subdirs illustrated previously.

export RUNLIBS=/home/mvstest

 /home/mvstest
 :-----testlibs        <-- $RUNLIBS
 :     :-----cblx        - compiled COBOL programs (.int's)
 :     :-----jcls        - copy here manually 1 by 1 during test/debug
 :     :-----sfun        - korn shell functions (jobset51,logmsg,etc)

export RUNDATA=/home/mvstest/testdata

 /home/mvstest
 :-----testdata        <-- $RUNDATA
 :     :-----ap          - Accounts Payable
 :     :-----ar          - Accounts Receivable
 :     :-----gl          - General Ledger
 :     :-----jobtmp      - temp files for SYSIN instream data
 :     :-----rpts        - SYSOUT printer files
 :     :-----tmp         - tmp subdir for uvsort
 :     :-----wrk         - interstep temporary work files

Executing the test/demo JCL/scripts

The pages ahead will present the commands to execute the following JCL/scripts:

jar100.ksh
  • simple 1 step COBOL (no PROCs, no instream data)
jar200.ksh
  • 2 steps (SORT+COBOL), uses instream data for SORT FIELDS
jgl100.ksh
  • 1 step COBOL, demos: PROCS
jgl200.ksh
  • 2 steps (SORT+COBOL),

After each execute command, we will illustrate the console display expected. Please confirm that you get the same results.

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

1F2. Converting Mainframe COBOL to Micro Focus COBOL

Execute demo scripts & observe Console Displays


 jar100.ksh
 ==========
 151026:122747:jar100: Begin Job=jar100
 151026:122747:jar100: /home/mvstest/testlibs/jcls/jar100.ksh
 151026:122747:jar100: Arguments: jar100.ksh
 151026:122747:jar100: ProcessID=17425
 151026:122747:jar100: RUNDATE=20151026
 151026:122747:jar100: RUNLIBS=/home/mvstest/testlibs
 151026:122747:jar100: RUNDATA=/home/mvstest/testdata
 151026:122747:jar100: JTMP=jobtmp/jar100
 151026:122747:jar100: SYOT=sysout/JAR100
 151026:122747:jar100: LOGNAME=mvstest TESTPROD=T000
 151026:122747:jar100: HOSTNAME=uvsoft5.uvsoftware.ca
 151026:122747:jar100: ******** Begin Step S0010 car100 (#1) ********
 151026:122747:jar100: file: CUSTMAS=data1/ar.customer.master fsize=8K
 151026:122747:jar100: file: NALIST=data1/ar.customer.nameadrs.list100 fsize=4K
 151026:122747:jar100: file: SYSOUT=sysout/JAR100/jar100_S0010_SYSOUT_151026_122747 fsize=0K
 151026:122747:jar100: Executing--> cobrun -F /home/mvstest/testlibs/cblx/car100
 151026:122747:JAR100: StepTimes: S0010 car100 Begun=12:27:47 End=12:27:47 Elapsed=00:00:00
 151026:122747:JAR100: Job Times: Begun=12:27:47 NormalEnd=12:27:47 Elapsed=00:00:00
 151026:122747:jar100: JobEnd=Normal, JCC=0, StepsExecuted=1, LastStep=S0010

 jar200.ksh
 ==========
 151026:122756:jar200: Begin Job=jar200
 151026:122756:jar200: /home/mvstest/testlibs/jcls/jar200.ksh
 151026:122756:jar200: RUNLIBS=/home/mvstest/testlibs
 151026:122756:jar200: RUNDATA=/home/mvstest/testdata
 151026:122756:jar200: JTMP=jobtmp/jar200
 151026:122756:jar200: SYOT=sysout/JAR200
 151026:122756:jar200: LOGNAME=mvstest TESTPROD=T000
 151026:122756:jar200: HOSTNAME=uvsoft5.uvsoftware.ca
 151026:122756:jar200: ******** Begin Step S0010 sort (#1) ********
 151026:122756:jar200: file: SORTIN=data1/ar.sales.items fsize=4K
 151026:122756:jar200: file: SORTOUT=jobtmp/jar200/t_tempsls fsize=0K
 151026:122756:jar200: file: SYSIN=jobtmp/jar200/S0010_sort_SYSIN fsize=0K
 151026:122756:jar200: Executing--> uvsort "fili1=data1/ar.sales.items,typ=RSF,rcs=64,filo1=...
 151026:122756:JAR200: uvsort fili1=data1/ar.sales.items,filo1=jobtmp/jar200/t_tempsls
 151026:122756:JAR200: EOF fili01 20 rds, 1280 size; data1/ar.sales.items
 151026:122756:JAR200: sort phase complete, used 512 megabytes, sort output begin
 151026:122756:JAR200: EOF filo01 16 wrts, 1024 size; jobtmp/jar200/t_tempsls
 151026:122756:JAR200: StepTimes: S0010 sort Begun=12:27:56 End=12:27:56 Elapsed=00:00:00
 151026:122756:jar200: ******** Begin Step S0020 car200 (#2) ********
 151026:122756:jar200: file: SALEDTL=jobtmp/jar200/t_tempsls fsize=4K
 151026:122756:jar200: file: CUSTMAS=data1/ar.customer.master.indexed fsize=12K
 151026:122756:jar200: file: SALELST=data1/ar.sales.list fsize=4K
 151026:122756:jar200: Executing--> cobrun -F /home/mvstest/testlibs/cblx/car200
 151026:122756:JAR200: StepTimes: S0020 car200 Begun=12:27:56 End=12:27:56 Elapsed=00:00:00
 151026:122756:JAR200: Job Times: Begun=12:27:56 NormalEnd=12:27:56 Elapsed=00:00:00
 151026:122756:jar200: JobEnd=Normal, JCC=0, StepsExecuted=2, LastStep=S0020

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

1F3. Converting Mainframe COBOL to Micro Focus COBOL

Notes re Console Displays

  1. Please see the JCL/scripts listed at JCLcnv1demo.htm#2C1 & 2C2. if you wish to relate the console displays to the originating lines in the scripts.

  2. Values of $RUNLIBS & $RUNDATA are displayed at 'JOB begin', to avoid any possible confusion between test libs/data & production libs/data.

  3. 'begin step' messages identify the step# & program executed.

  4. Data Filenames are displayed, prefixed by 'file:' in jar100. These filename displays are created by function 'exportfile' which can be seen at JCLcnv4gdg.htm#5J4.

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

1G1. Reconvert/Recompile Test/Demo COBOL copybooks/programs

reconvert COBOL copybook - 1 at a time


 cnvMF51cpy cpy0/CUSTMAS.cpy   <-- reconvert 1 COBOL copybook thru all steps
 =========================       cpy0 --> cpy1 --> cpy2 --> ?--> cpys
                               - prompts to copy to cpys ?
 --> y <-- reply y if OK to copy to cpys overwriting prior version
 --> n <-- reply 'n' if you have spent a lot of time modifying copybook in cpys
         - might reconvert to pick up some features of converter enhancements ?
         - or improving search/replace tables
         - cut & paste to combine new parts with old parts

reconvert & recompile COBOL program - 1 at a time


 cnvMF51 cbl0/CAR100.cbl   <-- reconvert 1 COBOL program thru all steps
 =======================       cbl0 --> cbl1 --> cbl2 --> cbl3 ?--> cbls
                             - prompts to copy to cbls & recompile
 --> y <-- reply y if OK to copy to cbls overwriting prior version
 --> n <-- reply 'n' if you have spent a lot of time modifying program in cbls
         - might reconvert to pick up some features of converter enhancements ?
         - or improving search/replace tables
         - cut & paste to combine new parts with old parts

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

1G2. Reconvert/Recompile Test/Demo COBOL copybooks/programs

reconvert COBOL copybooks - All in directory


 cnvMF51Acpy all    <-- reconvert All copybook in directory
 ============        cpy0 --> cpy1 --> cpy2 --> ?--> cpys
                   - prompts to continue at various points
 --> copy UNIXWORK1 & UNIXPROC1 from /home/uvadm/mvstest/cpy0 ?
 --> y <-- reply y if 1st time conversion of this directory

--> cleanup complete, enter to convert --> y <-- reply y to continue

 --> copy All copybooks from cpy2 to cpys
 --> y <-- reply 'y' if OK to overwriting prior versions
         - when enhancements are made to COBOL converter & search/replace tables
         - before many copybooks have been modified/tested/debugged
 --> n <-- reply 'n' if you have spent a lot of time modifying copybooks in cpys

reconvert & recompile COBOL - All programs in directory


 cnvMF51A all    <-- reconvert All programs in directory
 ===========        cbl0 --> cbl1 --> cbl2 --> cbl3 ?--> cbls
                  - prompts to continue at various points
 --> cleanup complete, enter to convert
 --> y <-- reply y to continue
 --> copy All programs from cbl2 to cbls & recompile ?
 --> y <-- reply 'y' if OK to overwrite prior versions & recompile all
         - when enhancements are made to COBOL converter & search/replace tables
         - before many programs have been modified/tested/debugged
 --> n <-- reply 'n' if you have spent a lot of time modifying programs in cbls

Alternative for AIX COBOL


 cnvAIXcpyA all   <-- convert copybooks for AIX COBOL
 ===============

 cnvAIXcblA all    <-- convert COBOL programs for AIX COBOL
 ==============

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

Part_2. COBOL Conversion Illustrated & Explained

Conversions Illustrated - CONTENTS


2A1. Directories for test/demo COBOL conversions

2B1. converting the COPYBOOKs
2B2. sample copybook - BEFORE & AFTER conversion

2C1. Operating Instructions to Convert & Compile COBOL programs
- illustrated using demo program 'car100.cbl'

2D1. sample program CAR100.cbl - BEFORE conversion
2D2. sample program car100.cbl - AFTER conversion
2D3. conversion changes illustrated & explained

2E1. unixwork1.cpy/unixproc1.cpy - inserted into all converted COBOL programs
Why you need unixwork1/unixproc1 ?
(SYSDATEs/RUNDATEs, store PARM data, decode file status, SQL connect)
2E3. unixwork1.cpy - copybook inserted at WORKING-STORAGE
2E4. unixproc1.cpy - copybook inserted at the end of the program
2E5. testunix1.cbl - supplied program to test/demo unixwork1 & unixproc1
unixwork3.cpy - WORKING-STORAGE version for AIX COBOL (vs Micro Focus)
unixproc3.cpy - PROCEDURE DIVISION version for AIX COBOL (vs Micro Focus)
2E6. Preparations to run unixtest1 (to demo unixwork1 & unixproc1)
2E7. Executing unixtest1
2E8. unixtest1 Run #1 - RUNDATA null & good filename exported
2E9. unixtest1 Run #2 - RUNDATA specified & BAD filename exported

2F1. Original mainframe JCL (JAR100) to execute COBOL program
2F2. Converted Korn shell script (jar100.ksh) to execute COBOL program

2G1. executing the demo JCL/script & COBOL program
- command, sample output report, sample input data record

2H1. SYSIN/SYSOUT optional conversion
- may be required if Micro Focus COBOL not available
- capabilities supplied by MF COBOL options INDD(SYSIN) & OUTDD(SYSOUT)

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

2A1. COBOL Conversion Illustrated & Explained

COBOL Conversion Illustrated & Explained

Part_1 gave the step by step Operating Instructions to convert ALL programs & copybooks in the directories, but did not illustrate or explain the changes made in the programs or copybooks.

Here in Part 2, we will use scripts to shorten the conversion instructions to convert either ALL or 1 at a time, and we will illustrate & explain the changes made.

Directories for test/demo COBOL conversions

 /home/mvstest    <-- setup user 'mvstest' & copy subdirs from uvadm/mvstest
 :-----testlibs
 :     :--*--Csub     - C subroutines for COBOL programs
 :     :--*--cbl0     - COBOL programs ('*' means files present)
 :     :-----cbl1     - cleaned up, cols 1-6 & 73-80 cleared, etc
 :     :-----cbl2     - cnvMF5 converts mainframe COBOL to Micro Focus COBOL
 :     :-----cbl3     - sysin1 converts control stream reader to disk file
 :     :-----cbl4     - sysout1 converts DISPLAY upon SYSOUT to write a file
 :     :-----cbls     - copy here (standard source library) before compiling
 :     :-----cblx     - compiled COBOL programs (.int's)
 :     :-----cpy0     - for COBOL copybooks
 :     :-----cpy1     - cleaned up, cols 1-6 & 73-80 cleared, etc
 :     :-----cpy2     - cnvMF5 converts mainframe COBOL to Micro Focus COBOL
 :     :-----cpys     - copy here (standard copybook library)
 :     :--*--ctl      - conversion control files (cnvcob5.tbl, cobdirectives)

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

2B1. COBOL Conversion Illustrated & Explained

converting the COPYBOOKs

 cpy0 ---------> cpy1 ---------> cpy2 ----------> cpys
       cleanup         convert         copy(cp)

convert ALL copybooks (initially)


 #1. cnvMF51Acpy all    <-- convert ALL copybooks from cpy0 to cpy1 & cpy2
     ============

 #2. cp cpy2/* cpys  <-- copy ALL converted copybooks to cpys (used by compiler)
     ==============

convert 1 copybook (missing/changed during test/debug)


 #1. cnvMF51cpy CUSTMAS.cpy      <-- convert 1 copybook from cpy0 to cpy1 & cpy2
     ====================

 #2. diff -b cpy2/custmas.cpy cpys/custmas.cpy <--optional diff (see notes below)
     =========================================

 #3. cp cpy2/custmas.cpy cpys  <-- copy 1 copybook to cpys (used by compiler)
     ========================

Notes

  1. Use 'cnvMF51Acpy' initially to mass convert ALL copybooks.

  2. Use 'cnvMF51cpy' during testing if you discover missing or out-of-date copybooks that need to be brought over from the mainframe.

  3. By convention copybook filenames in cpy0 (from the mainframe) are in UPPER case & have no .extensions. The conversion changes the names to lower case & adds the '.cpy' extension.

  4. The converted copybooks are not automatically copied to 'cpys' because if test/debug is already in progress, we don't want to overwrite any copybooks that have been modified.

  5. If in doubt perform the 'diff' illustrated above to confirm changes made on the mainframe since conversion started or changes made on the new system during test/debug.

    Alternative for AIX COBOL


 cnvAIXcpyA all    <-- convert copybooks for AIX COBOL
 ===============

 cnvAIXcblA all     <-- convert COBOL programs for AIX COBOL
 ==============

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

2B2. COBOL Conversion Illustrated & Explained

sample copybook - BEFORE conversion

 000001* CUSTMAS - COBOL COPYBOOK FOR CUSTOMER.MASTER FILE               CUSTMAS
 000002     10 CM-CUST          PIC  9(6).                               CUSTMAS
 000003     10 CM-DELETE        PIC  X(4).                               CUSTMAS
 000004     10 CM-NAMEADRS.                                              CUSTMAS
 000005        20 CM-NAME       PIC  X(25).                              CUSTMAS
 000006        20 CM-ADRS       PIC  X(25).                              CUSTMAS
 000007        20 CM-CITY       PIC  X(16).                              CUSTMAS
 000008        20 FILLER        PIC  X.                                  CUSTMAS
 000009        20 CM-PROV       PIC  X(2).                               CUSTMAS
 000010        20 FILLER        PIC  X.                                  CUSTMAS
 000011        20 CM-POSTAL     PIC  X(10).                              CUSTMAS
 000012     10 CM-TELEPHONE     PIC  X(12).                              CUSTMAS
 000013     10 CM-CONTACT       PIC  X(18).                              CUSTMAS
 000014     10 CM-THISYR-SALES  PIC  S9(7)V99 COMP-3 OCCURS 12.          CUSTMAS
 000015     10 CM-LASTYR-SALES  PIC  S9(7)V99 COMP-3 OCCURS 12.          CUSTMAS
 000016     10 FILLER           PIC  X(16).                              CUSTMAS

sample copybook - AFTER conversion

       * custmas - cobol copybook for customer.master file
            10 cm-cust          pic  9(6).
            10 cm-delete        pic  x(4).
            10 cm-nameadrs.
               20 cm-name       pic  x(25).
               20 cm-adrs       pic  x(25).
               20 cm-city       pic  x(16).
               20 filler        pic  x.
               20 cm-prov       pic  x(2).
               20 filler        pic  x.
               20 cm-postal     pic  x(10).
            10 cm-telephone     pic  x(12).
            10 cm-contact       pic  x(18).
            10 cm-thisyr-sales  pic  s9(7)v99 comp-3 occurs 12.
            10 cm-lastyr-sales  pic  s9(7)v99 comp-3 occurs 12.
            10 filler           pic  x(16).

functions performed by cleanup/conversion

  1. Clear columns 1-6 & 73-80

  2. convert to lower case except in quotes

  3. change name from UPPER case to lower case with extension '.cpy' In this example, 'CUSTMAS' is changed to 'custmas.cpy'.

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

2C1. COBOL Conversion Illustrated & Explained

converting the PROGRAMs & compiling

 cbl0 ---------> cbl1 ---------> cbl2 ----------> cbls ---------> cblx
       cleanup         convert         copy(cp)         compile

convert ALL programs (initially)


 #1. cnvMF51A all     <-- convert ALL programs from cbl0 to cbl1 & cbl2
     ===========

 #1a. cnvAIXcblA all  <-- convert All programs for AIX COBOL
      ==============

 #2. cp cbl2/* cbls   <-- copy ALL converted programs to cbls (used by compiler)
     ==============

 #3. mfcblA all       <-- compile all programs from cbls to cblx & cblst
     ==========

convert 1 program (missing/changed during test/debug)


 #1. cnvMF51 CAR100.cbl       <-- convert 1 program from cbl0 to cbl1 & cbl2
     ==================

 #1a. cnvAIXcbl1 all          <-- convert 1 COBOL programs for AIX COBOL
      ==============

 #2. diff -b cbl2/car100.cbl cbls/car100.cbl  <-- optional diff (see notes below)
     =======================================

 #3. cp cbl2/car100.cbl cbls  <-- copy 1 program to cbls (used by compiler)
     =======================

 #4. mfcbl1 car100.cbl        <-- compile the program
     =================

Notes

  1. Use 'cnvMF51A' initially to mass convert ALL programs.

  2. Use 'cnvMF51' during testing if you discover missing or out-of-date programs that need to be brought over from the mainframe.

  3. By convention programs filenames in cbl0 (from the mainframe) are in UPPER case & have no .extensions. The conversion changes the names to lower case & adds the '.cbl' extension.

  4. The converted programs are not automatically copied to 'cbls' because if test/debug is already in progress, we don't want to overwrite any programs that have been modified.

  5. If in doubt perform the 'diff' illustrated above to confirm changes made on the mainframe since conversion started or changes made on the new system during test/debug.

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

2D1. COBOL Conversion Illustrated & Explained

sample program - Original mainframe version

 000010 IDENTIFICATION DIVISION.                                         CAR100
 000020* CAR100 - TEST/DEMO MAINFRAME CONVERSION TO MICRO FOCUS COBOL    CAR100
 000030*        - CUSTOMER N&A LIST WITH REPORT HDNG & DATE VIA ACCEPT   CAR100
 000040 PROGRAM-ID. CAR100.                                              CAR100
 000050 ENVIRONMENT DIVISION.                                            CAR100
 000060 INPUT-OUTPUT SECTION.                                            CAR100
 000070 FILE-CONTROL.                                                    CAR100
 000080     SELECT CUSTMAS ASSIGN CUSTMAS                                CAR100
 000090            ORGANIZATION SEQUENTIAL ACCESS MODE SEQUENTIAL.       CAR100
 000100     SELECT NALIST ASSIGN NALIST                                  CAR100
 000110            ORGANIZATION SEQUENTIAL.                              CAR100
 000120 DATA  DIVISION.                                                  CAR100
 000130 FILE SECTION.                                                    CAR100
 000140 FD  CUSTMAS RECORD CONTAINS 256 CHARACTERS.                      CAR100
 000150     01 CM1. COPY "CUSTMAS.CPY".                                  CAR100
 000160 FD  NALIST RECORD CONTAINS 120 CHARACTERS.                       CAR100
 000170     01 LISTREC.                                                  CAR100
 000180        05 LIST-CUST       PIC 9(6).                              CAR100
 000190        05 LIST-DELETE     PIC X(4).                              CAR100
 000200        05 LIST-NAMEADRS   PIC X(80).                             CAR100
 000210 WORKING-STORAGE SECTION.                                         CAR100
 000220 01  PAGE-HDNGS.                                                  CAR100
 000230     05 FILLER            PIC X(40) VALUE                         CAR100
 000240        'CAR100: CUSTOMER NAME & ADDRESS LIST    '.               CAR100
 000250     05 RUN-DATE          PIC X(20) VALUE SPACES.                 CAR100
 000260     05 FILLER            PIC X(60) VALUE SPACES.                 CAR100
 000270 01  CM1-EOF              PIC X VALUE ' '.                        CAR100
 000280*                                                                 CAR100
 000290 PROCEDURE DIVISION.                                              CAR100
 000300 MAINLINE.                                                        CAR100
 000310     ACCEPT RUN-DATE FROM DATE.                                   CAR100
 000320     OPEN INPUT CUSTMAS. OPEN OUTPUT NALIST.                      CAR100
 000330     WRITE LISTREC FROM PAGE-HDNGS BEFORE ADVANCING 2 LINES.      CAR100
 000340     READ CUSTMAS AT END MOVE '1' TO CM1-EOF.                     CAR100
 000350     PERFORM DTLRTN UNTIL CM1-EOF = '1'.                          CAR100
 000360     CLOSE CUSTMAS NALIST.                                        CAR100
 000370     STOP RUN.                                                    CAR100
 000380 DTLRTN.                                                          CAR100
 000390     MOVE SPACES TO LISTREC.                                      CAR100
 000400     MOVE CM-CUST TO LIST-CUST.                                   CAR100
 000410     MOVE CM-DELETE TO LIST-DELETE.                               CAR100
 000420     MOVE CM-NAMEADRS TO LIST-NAMEADRS.                           CAR100
 000430     WRITE LISTREC BEFORE ADVANCING 1 LINE.                       CAR100
 000440     READ CUSTMAS AT END MOVE '1' TO CM1-EOF.                     CAR100

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

2D2. COBOL Conversion Illustrated & Explained

sample program - AFTER cleanup & convert

        identification division.
       * car100 - test/demo mainframe conversion to micro focus cobol
       *        - customer n&a list with report hdng & date via accept
        program-id. car100.
 uvM   * converted by cnvMF5 uvcopy 20160415 on 2016/08/17_11:07:53
        environment division.
        input-output section.
        file-control.
 uvM        select custmas assign external CUSTMAS
            organization record sequential access mode sequential.
 uvM        select nalist assign external NALIST
 uvM               organization line sequential.
        data  division.
        file section.
        fd  custmas record contains 256 characters.
        01  cm1. copy "custmas.cpy".
        fd  nalist record contains 120 characters.
        01  listrec.
               05 list-cust       pic 9(6).
               05 list-delete     pic x(4).
               05 list-nameadrs   pic x(80).
               05 filler          pic x(30).
        working-storage section.
 uvM    copy "unixwork1.cpy".
        01  page-hdngs.
            05 filler            pic x(40) value
               'CAR100: CUSTOMER NAME & ADDRESS LIST    '.
            05 run-date          pic x(20) value spaces.
            05 filler            pic x(60) value spaces.
        01  cm1-eof              pic x value ' '.
 uvM   *
        procedure division.
 uvM        perform unixproc1.
        mainline.
            accept run-date from date.
            open input custmas. open output nalist.
            write listrec from page-hdngs before advancing 2 lines.
            read custmas at end move '1' to cm1-eof.
            perform dtlrtn until cm1-eof = '1'.
            close custmas nalist.
            stop run.
        dtlrtn.
            move spaces to listrec.
            move cm-cust to list-cust.
            move cm-delete to list-delete.
            move cm-nameadrs to list-nameadrs.
            write listrec before advancing 1 line.
            read custmas at end move '1' to cm1-eof.
 uvM    copy "unixproc1.cpy".

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

2D3. COBOL Conversion Illustrated & Explained

SELECT statement changes

 uvM   *    select custmas assign custmas
 uvM   *           organization sequential access mode sequential.
 uvM        select custmas assign EXTERNAL custmas
 uvM               organization RECORD sequential access mode sequential.
  1. The original 'select' is shown as a *comment, so you can see the changes

  2. The most important change is to insert 'EXTERNAL' (caps to highlight above). 'assign external' causes Micro Focus COBOL to determine the physical filename by searching environmental variables for the value of the external(logical) filename. The JCL conversion 'export's the DLBL name1 to match the external(logical) name.

  3. 'organization sequential' is made explicit 'organization RECORD sequential' to make the default clear. Printer files must be 'LINE sequential' and will be so coded if the converter sees the word 'printer' in the file assignment. You may have to make this manual correction.

  4. Some customers use the conversion opportunity to also change some other files (such as input transaction files) to 'LINE sequential', because it makes them easier to create, edit,& list with unix/linux tools (vi, more, lp, etc).

    copybooks & perform inserted by COBOL converter

The following copybooks & 'perform' are inserted at the following locations:


 #1. copy "unixwork1.cpy".   <-- inserted after 'WORKING-STORAGE'
     =====================     - stores values captured by unixproc1

 #2. perform unixproc1.      <-- inserted after 'PROCEDURE DIVISION'
     ==================

 #3. copy "unixproc1.cpy".   <-- inserted at end of program
     =====================

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

2E1. unixwork1.cpy/unixproc1.cpy - why you need them

1. unixwork1/unixproc1 provide SYSDATEs & RUNDATEs

unixwork1 & unixproc1 provide for both SYSDATEs & RUNDATEs. On mainframes the JCL could set a DATE different than the system date & COBOL programs with 'ACCEPT DATE' or CURRENT-DATE would get this RUNDATE.

On unix & Micro Focus COBOL 'ACCEPT DATE' always gets the system date, not the RUNDATE set in the JCL. The Vancouver Utility JCL & COBOL conversions provide for a different RUNDATE. The operator can specify RUNDATE on the command line or it could be 'export'ed from the shell script or at the shell command prompt.


 #1a. jobxx.ksh RUNDATE=yyyymmdd <-- specify RUNDATE on job execute command
      ==========================

 #1b. export RUNDATE=yyyymmdd    <-- specify RUNDATE from shell prompt
      =======================      - then effective for all future executes

 #1c. export RUNDATE=yyyymmdd    <-- specify RUNDATE in shell script
      =======================      - then need to modify date for each run

Note that all converted JCL/scripts call function 'jobset51' on line 9.


 jobset51  #initialization function: restart,setup subdirs,export RUNDATE, etc
 ========

 export RUNDATE=yyyymmdd    <-- jobset51 includes 'export RUNDATE'
 =======================      - defaults to current system date

'jobset51' tests $RUNDATE for a value already exported by 1a,1b,or 1c and if still null will set the value to the current system date.

COBOL programs perform 'unixproc1.cpy' which retrieves the value of $RUNDATE and stores it in various formats in 'unixwork1.cpy', for use as needed by COBOL programs.

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

2E2. unixwork1 & unixproc1 - why you need them

2. unixwork1/unixproc1 decode COBOL file status

unixproc1 provides a subrtn to decode the Micro Focus COBOL file status. When the 1st byte of the 2 byte file status is '9', the 2nd byte is a binary value (1-255). If programmers need to show this value, it is easy for them to use this subrtn rather than have to recode it for each program.

3. unixwork1/unixproc1 store PARM date

unixwork1 & unixproc1 provide the 'PARM data' feature of mainframes The JCL converter converts EXECs with PARM data as shown below:

      // EXEC PGM=COBOLX,PARM='xxxxxxxxxxxxxxxxxxx'
      export PARM="xxxxxxxxxxxxxxxxxxxx"
      cobrun $ANIM $CBLX/cobolx

unixproc1 accepts the PARM data from environment-variable 'PARM' & stores the data in the parm data fields provided by unixwork1. unixproc1 allows up to 200 bytes of data, ensures blank right filling, & also stores the data length actually present.

4. unixwork1/unixproc1 provide for contingencies

unixwork1 & unixproc1 provide for contingencies. They are a convenient place to add items in 1 place for access by all programs as the need arises during conversions for those site dependent hard to predict contingencies.

inserting SQL CONNECT for DB2 conversions

This is a good example of contingency use of unixproc1.cpy & unixwork1.cpy. When we convert a site where most COBOL programs needed to connect to an ORACLE database (was DB2 on mainframe). It is easy to supply this connection to all COBOL programs, simply by adding 1 line of code to the common copybook 'unixproc1.cpy'.


      EXEC SQL CONNECT DSNE/ORACLE@SOA END-EXEC.
      ==========================================

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

2E3. COBOL Conversion Illustrated & Explained

unixwork1 - copybook inserted at Working-Storage

       * unixwork1 - copybook for mainframe to unix/linux conversions
       *           - unixwork1/unixproc1 for rundate in ccyymmdd
       *           - see unixwork2/unixproc2 for mm/dd/ccyy format
       *           - converter inserts following into all cobol programs
       *
       *  copy "unixwork1.cpy".  <-- inserted after 'WORKING-STORAGE'
       *                             w-s fields used by unixproc1.cpy
       *  perform unixproc1.     <-- inserted after 'PROCEDURE DIVISION'
       *  copy "unixproc1.cpy".  <-- inserted at end of program
       *
       * unixproc1 accepts date,time,env-vars jobid1,jobid2,parm,rundate
       * - jobid2 is the jcl/script calling this program
       * - jobid1 is the 1st/parent jcl (that may have called jobid2)
       * - formats jobstamp for cobol converter option to prefix displays
       * - includes code to display micro focus file status
        01 unixwork1.
            05 jobid1             pic x(16).
            05 jobid2             pic x(16).
            05 parmdatalth        pic s9(4).
            05 parmworkdata       pic x(200).
       * parmworkdata retrieved by unixproc1 via env-name/value parm
       * see demo jcl/cobol jar120/car120 in mvscobol.doc page 3a1+
       * - mainframe programs use linkage section to store parm lth/data
       * - must move lth/data from this w/s to l/s separately
       * - since parmdatalth is 4 bytes char vs mainframe 2 bytes comp
       * following dates stored by unixproc1
            05 sysdates.
               10 sysdate-ymd8    pic x(8).
               10 sysdate-ymd8e   pic x(10).
               10 sysdate-ymd6    pic x(6).
               10 sysdate-ymd6e   pic x(8).
               10 sysdate-mdy8    pic x(8).
               10 sysdate-mdy8e   pic x(10).
               10 sysdate-mdy6    pic x(6).
               10 sysdate-mdy6e   pic x(8).
            05 rundates.
               10 rundate-ymd8    pic x(8).
               10 rundate-ymd8e   pic x(10).
               10 rundate-ymd6    pic x(6).
               10 rundate-ymd6e   pic x(8).
               10 rundate-mdy8    pic x(8).
               10 rundate-mdy8e   pic x(10).
               10 rundate-mdy6    pic x(6).
               10 rundate-mdy6e   pic x(8).
            05 systimes.
               10 systime-hmsh    pic 9(8).
               10 systime-hms6    pic 9(6).
            05 jobstamp.
               10 js-date         pic 9(6).
               10 filler          pic x value ':'.
               10 js-time         pic 9(6).
               10 filler          pic x value ':'.
               10 js-jobid        pic x(8).
               10 filler          pic xx value ': '.
       * fields to display micro focus cobol file status
       * 2nd byte binary err code if 1st byte character '9'
            05 mf-filestat-work.
               10 mf-filenamei    pic x(30).
               10 mf-filenamex    pic x(50).
               10 mf-filestat     pic xx.
               10 filler redefines mf-filestat.
                  15 mf-fs1       pic x.
                  15 mf-fs2       pic x comp-x.
               10 mf-fs2d         pic 999.
       *
       *oct10/07 - sql-init-flag added for efunds
        77  sql-init-flag         pic s9(9) comp.
       **************** end of unixwork1 ***************************
Note
  • unixwork1.cpy (above) is for Micro Focus COBOL.
  • unixwork3.cpy for AIX COBOL is not listed here, but you can see
    at $UV/mf/cpys/... or $UV/mvstest/testlibs/cpy0/...
  • if you have the Vancouver Utilities installed

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

2E4. COBOL Conversion Illustrated & Explained

unixproc1 - copybook inserted at Procedure Division

       * unixproc1 - copybook for mainframe to unix/linux conversions
       *           - perform various tasks to facilitate conversions
       *           - you can add code here to be executed by all cobols
       *           - converter inserts following into all cobol programs
       *
       *  copy "unixwork1.cpy".  <-- inserted after 'WORKING-STORAGE'
       *                             w-s fields used by unixproc1.cpy
       *  perform unixproc1.     <-- inserted after 'PROCEDURE DIVISION'
       *  copy "unixproc1.cpy".  <-- inserted at end of program
       *
       * declare dummy section to stop user performs w/o thru end-para
        999-section section.
        999-section-end. end-section.
        unixproc1.
       *
       *oct08/07/ot - connect to oracle database here in unixproc1
       * - unixproc1.cpy is called by all converted programs
       * - should do no harm in programs that do not need to connect
       * - following sample used at efunds (modify at other sites)
       ***  exec sql connect dsne/oracle@soa end-exec.
       *** *commented out for mvstest demos at uv software
       * - great example of usefulness of inserting a call to a common
       *   copybook into all cobol programs at conversion time
       * - then you can just update the common copybook, when you need to
       *   add code to be executed by all cobol programs
       *
       * accept environmental variables (jobid1,jobid2,parm,rundate)
       * - jobid2 is the jcl/script calling this program
       * - jobid1 is the 1st/parent jcl (that may have called jobid2)
            display "JOBID1" upon environment-name
            accept  jobid1   from environment-value
            display "JOBID2" upon environment-name
            accept  jobid2   from environment-value
            display "PARM"    upon environment-name
            accept parmworkdata from environment-value.
       *
       * calc parm data length by scanning backward to last data byte
       * - store in w-s for possible use by cobol program
            move 100 to parmdatalth.
            perform until (parmworkdata (parmdatalth:1) not = " "
                       or  (parmdatalth < 1))
                    subtract 1 from parmdatalth
            end-perform.
       * jcl converter has 'export PARM="..." for PARM on EXEC stmnt
       * see parmworkdata & parmdatalth in unixwork1.cpy inserted at w-s
       * alternate method to store parm - call c subrtn 'getparm'
       ***  call "getparm" using parm2-lth parm2-data.
       * - commented out since same as parm1 cobol method above
       * - some users might need c subrtns to replace assembler subrtns
       *
       * get system date & time - store in various formats
       * - fields defined in unixwork1.cpy as follows:
       * sysdate-ymd8  pic x(8)  = 'ccyymmdd'
       * sysdate-ymd6  pic x(6)  = 'yymmdd'
       * sysdate-mdy8  pic x(8)  = 'mmddccyy'
       * sysdate-mdy6  pic x(6)  = 'mmddyy'
       * sysdate-ymd8e pic x(10) = 'ccyy/mm/dd'
       * sysdate-ymd6e pic x(8)  = 'yy/mm/dd'
       * sysdate-mdy8e pic x(10) = 'mm/dd/ccyy'
       * sysdate-mdy6e pic x(8)  = 'mm/dd/yy'
       * systime-hmsh  pic 9(8)  = 'HHMMSShh'
       * systime-hms6  pic 9(6)  = 'HHMMSS'
            accept sysdate-ymd8 from date yyyymmdd
            accept systime-hmsh from time
            move systime-hmsh(1:6)  to systime-hms6
            move sysdate-ymd8(3:6)  to sysdate-ymd6
            move sysdate-ymd8(5:4)  to sysdate-mdy8(1:4)
            move sysdate-ymd8(1:4)  to sysdate-mdy8(5:4)
            move sysdate-ymd8(5:4)  to sysdate-mdy6(1:4)
            move sysdate-ymd8(3:2)  to sysdate-mdy6(5:2)
            move sysdate-ymd8(1:4)  to sysdate-ymd8e(1:4)
            move "/"               to sysdate-ymd8e(5:1)
            move sysdate-ymd8(5:2)  to sysdate-ymd8e(6:2)
            move "/"               to sysdate-ymd8e(8:1)
            move sysdate-ymd8(7:2)  to sysdate-ymd8e(9:2)
            move sysdate-ymd8e(3:8) to sysdate-ymd6e
            move sysdate-ymd8e(6:5) to sysdate-mdy8e(1:5)
            move "/"               to sysdate-mdy8e(6:1)
            move sysdate-ymd8e(1:4) to sysdate-mdy8e(7:4)
            move sysdate-mdy8e(1:6) to sysdate-mdy6e(1:6)
            move sysdate-mdy8e(9:2) to sysdate-mdy6e(7:2).
       *
            display "RUNDATE" upon environment-name
            accept  rundate-ymd8  from environment-value.
            if rundate-ymd8 numeric
            move rundate-ymd8(3:6)  to rundate-ymd6
            move rundate-ymd8(5:4)  to rundate-mdy8(1:4)
            move rundate-ymd8(1:4)  to rundate-mdy8(5:4)
            move rundate-ymd8(5:4)  to rundate-mdy6(1:4)
            move rundate-ymd8(3:2)  to rundate-mdy6(5:2)
            move rundate-ymd8(1:4)  to rundate-ymd8e(1:4)
            move "/"                to rundate-ymd8e(5:1)
            move rundate-ymd8(5:2)  to rundate-ymd8e(6:2)
            move "/"                to rundate-ymd8e(8:1)
            move rundate-ymd8(7:2)  to rundate-ymd8e(9:2)
            move rundate-ymd8e(3:8) to rundate-ymd6e
            move rundate-ymd8e(6:5) to rundate-mdy8e(1:5)
            move "/"                to rundate-mdy8e(6:1)
            move rundate-ymd8e(1:4) to rundate-mdy8e(7:4)
            move rundate-mdy8e(1:6) to rundate-mdy6e(1:6)
            move rundate-mdy8e(9:2) to rundate-mdy6e(7:2)
            else move sysdates to rundates.
       *
       * format jobstamp (date:time:jobid) for cobol cnvrt option j1
       * to display jobstamp prior to any display ... upon console.
            move sysdate-ymd6 to js-date
            move systime-hms6 to js-time
            move jobid2       to js-jobid.
            exit.
       *
       * paragraph to display file status
       * - see file status storage fields inserted at working storage
       * cobol converter inserts this code at end of each user program
       * when file status not '00', programmers may add following code:
       *    move filexxstatus to mf-filestat
       *    move "internal-filename" to mf-filenamei
       *    move "external-filename" to mf-filenamex
       *    perform mf-display-filestat-eoj.
       * for example if the select stmnt were:
       *    select customer-master assign external custmas
       *           file status is customer-status
       * then your coding would be:
       *    move customer-status   to mf-filestat
       *    move "CUSTOMER-MASTER" to mf-filenamei
       *    move "CUSTMAS"         to mf-filenamex
       *    perform mf-display-filestat-eoj.
        mf-display-filestat-eoj.
            display mf-filenamex upon environment-name
            accept  mf-filenamex from environment-value
            move mf-fs2 to mf-fs2d
            display "File Err, Internal name: " mf-filenamei upon console
            display "File Err, External name: " mf-filenamex upon console
            display "File Status = " mf-filestat " "
                  mf-fs1 "/" mf-fs2d upon console.
            stop run returning mf-fs2d.
       **************** end of unixproc1 ***************************
Note
  • unixproc1.cpy (above) is for Micro Focus COBOL.
  • unixproc3.cpy for AIX COBOL is not listed here, but you can see
    at $UV/mf/cpys/... or $UV/mvstest/testlibs/cpy0/...
  • if you have the Vancouver Utilities installed

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

2E5. COBOL Conversion Illustrated & Explained

testunix1.cbl - program to demo unixwork1 & unixproc1

        identification division.
       * testunix1 - test/demo mainframe conversion to micro focus cobol
       *           - vancouver utilities from www.uvsoftware.ca
       * this program tests unixproc1.cpy & unixwork1.cpy
       *  - code inserted into user programs by cobol converter (cnvmf4/5
       * perform unixproc1.     <-- inserted after 'PROCEDURE DIVISION'
       * copy "unixproc1.cpy".  <-- inserted at end of program
       * - accepts date & env-variables (jobid1,jobid2,parm,rundate)
       * - includes code to display micro focus file status
       * copy "unixwork1.cpy".  <-- inserted after 'WORKING-STORAGE'
       *                          - stores values accepted by unixproc1
        program-id. testunix1.
 uvM   * converted by cnvMF5 uvcopy 20150926 on 2015/10/02_13:44:54
        environment division.
        input-output section.
        file-control.
            select custmas assign external custmas
              organization indexed access sequential
              file status custmas-stat
              record key custnum
              alternate key custname with duplicates.
        data  division.
        file section.
        fd  custmas record contains 256 characters.
            01 custmasrec.
               05 custnum        pic   x(6).
               05 filler         pic   x(4).
               05 custname       pic   x(25).
               05 custdata       pic   x(221).
        working-storage section.
        01  misc.
            05  custmas-stat     pic xx value spaces.
       *
        procedure division.
            display "JOBID1 "         jobid1        upon console.
            display "JOBID2 "         jobid2        upon console.
            display "parm1-lth "      parm1-lth     upon console.
            display "parm1-data "     parm1-data    upon console.
       *    display "parm2-lth "      parm2-lth     upon console.
       *    display "parm2-data "     parm2-data    upon console.
       *
            display "sysdate-ymd8  "  sysdate-ymd8  "  "
                                      sysdate-ymd8e upon console.
            display "sysdate-ymd6  "  sysdate-ymd6  "    "
                                      sysdate-ymd6e upon console.
            display "sysdate-mdy8  "  sysdate-mdy8  "  "
                                      sysdate-mdy8e upon console.
            display "sysdate-mdy6  "  sysdate-mdy6  "    "
                                      sysdate-mdy6e upon console.
       *
            display "rundate-ymd8  "  rundate-ymd8  "  "
                                      rundate-ymd8e upon console.
            display "rundate-ymd6  "  rundate-ymd6  "    "
                                      rundate-ymd6e upon console.
            display "rundate-mdy8  "  rundate-mdy8  "  "
                                      rundate-mdy8e upon console.
            display "rundate-mdy6  "  rundate-mdy6  "    "
                                      rundate-mdy6e upon console.
       *    display "current-date  "  current-date  upon console.
       * above (current-date) applies only to vse (not mvs)
       *
            open input custmas.
            if custmas-stat not = '00'
               move custmas-stat to mf-filestat
               move "CUSTMAS"    to mf-filenamei
               move "CUSTMAS"    to mf-filenamex
               perform mf-display-filestat-eoj
            else display "CUSTMAS opened OK" upon console.
            close custmas.
            stop run.

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

2E6. COBOL Conversion Illustrated & Explained

prep to demo unixwork1.cpy & unixproc1.cpy

'testunix1.cbl' is provided to demonstrate 'unixwork1.cpy' & 'unixproc1.cpy'. These 2 copybooks are inserted by the COBOL converter into all user COBOL programs just after 'Working-Storage' & at the end of the program. The converter also inserts 'perform unixproc1' just after 'Procedure Division'. Please see the listings on the previous few pages.

We assume here that:


 #1. You have setup userid mvstest & copied the demo files from uvadm
     - as documented on pages '1C1' & '1C2'

 #2. You have converted the mvstest copybooks
     - from cpy0 --> cpy1 --> cpy2 --> cpys
     - as documented on page '1D1'

 #3. You have converted the mvstest COBOL programs
     - from cbl0 --> cbl1 --> cbl2 --> cbls
     - as documented on page '1D2'

 #4. You have converted the mvstest JCL/scripts
     - from jcl0 --> jcl1 --> jcl2 --> jcl3 --> jcls
     - as documented on page '1E1' & '1E2'
     - Actually, not required here, since unixtest1 can be run from
       by exporting environmental variables on the command line
       before executing the program directly via
       'cobrun cblx/testunix1'

 #5. You have compiled the mvstest COBOL programs
     - from cbls --> cblx
     - as documented on page '1D3'

 #6. You are currently logged in as mvstest and in /home/mvstest
     a. $RUNLIBS/cblx/    - holds the compiled program 'testunix1.int'
     b. $RUNDATA/data1/   - holds the demo data file 'ar.customer.master.indexed'

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

2E7. COBOL Conversion Illustrated & Explained

Executing testunix1

'testunix1' will display values for environmental variables JOBID1/2, PARM, & RUNDATE. The values for these symbols are captured by 'unixproc1.cpy' & stored in the fields defined by 'unixwork1.cpy'. Note that the COBOL converter inserts the copy statements for these at Working Storage & at the end of the program. It also inserts a 'perform unixproc1' just after the Procedure Division.

You may run 'testunix1' without any JCL/script, by simply exporting values for environmental variables JOBID1/2, PARM,& RUNDATE from the command line, before executing the program directly via 'cobrun cblx/testunix1'. Then observe the values displayed on the screen.

You can also test the 'file status display' by exporting a filename (good & BAD) for the CUSTMAS demo file included in unixtest1 for just this purpose.

 See test/demos on the next page ----->

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

2E8. COBOL Conversion Illustrated & Explained

unixtest1 - run #1


 #1. export JOBID2=JOBXXX
     ===================

 #2. export PARM="Test/Demo testunix1.cbl, unixwork1.cpy,& unixproc1.cpy"
     ====================================================================

 #3. export RUNDATE=""  <-- rundates default to sysdates when RUNDATE undefined
     =================

 #4. export CUSTMAS=testdata/data1/ar.customer.master.indexed
     ========================================================

 #5. cobrun cblx/testunix1  <-- execute the program
     =====================

expected results from run #1

JOBID2 JOBXXX parm1-lth 0055+ parm1-data Run testunix1.cbl to demo unixwork1.cpy & unixproc1.cpy

 sysdate-ymd8  20050925  2005/09/25
 sysdate-ymd6  050925    05/09/25
 sysdate-mdy8  09252005  09/25/2005
 sysdate-mdy6  092505    09/25/05
 rundate-ymd8  20050925  2005/09/25
 rundate-ymd6  050925    05/09/25
 rundate-mdy8  09252005  09/25/2005
 rundate-mdy6  092505    09/25/05
 CUSTMAS opened OK

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

2E9. COBOL Conversion Illustrated & Explained

unixtest1 - run #2


 #1. export JOBID2=JOBXXX
     ===================

 #2. export PARM="Test/Demo testunix1.cbl, unixwork1.cpy,& unixproc1.cpy"
     ====================================================================

 #3. export RUNDATE="20051231"    <-- rundates will now differ from sysdates
     =========================

 #4. export CUSTMAS=testdata/data1/ar.customer.master.indexedXXX <-- make BAD filename
     ===========================================================
     - see the File Error Status displayed below

 #5. cobrun cblx/testunix1  <-- execute the program
     =====================

expected results from run #2

JOBID2 JOBXXX parm1-lth 0055+ parm1-data Run testunix1.cbl to demo unixwork1.cpy & unixproc1.cpy

sysdate-ymd8 20050925 2005/09/25 sysdate-ymd6 050925 05/09/25 sysdate-mdy8 09252005 09/25/2005 sysdate-mdy6 092505 09/25/05 rundate-ymd8 20051231 2005/12/31 rundate-ymd6 051231 05/12/31 rundate-mdy8 12312005 12/31/2005 rundate-mdy6 123105 12/31/05 File Err, Internal name: CUSTMAS File Err, External name: testdata1/customer.master.indexedXXX File Status = 35 3/053

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

2F1. COBOL Conversion Illustrated & Explained

JCL & script to execute demo COBOL program

Here are the JCL & converted Korn shell script required to execute the COBOL demo program car100.cbl. The JCL/script conversions are documented at JCLcnv1demo.htm#2A1 & 2A2.

 j#001 //JAR100   JOB  'TEST MVS2UNIX CONVERSION',DATE=20080323
 j#002 //* CUSTOMER NAME & ADDRESS LIST (WITH DATE & RPT HDNGS)
 j#003 //STEP010  EXEC PGM=CAR100,PARM=2008
 j#004 //CUSTMAS  DD DSN=AR.CUSTOMER.MASTER,DISP=SHR
 j#005 //NALIST   DD DSN=AR.CUSTOMER.NAMEADRS.LIST100,DISP=(,CATLG,DELETE),
 j#006 //            UNIT=DISK,SPACE=(TRK,(25,25),RLSE),
 j#007 //            DCB=(MODEL.DSCB,LRECL=133,BLKSIZE=6118,RECFM=FBA)
 j#008 //SYSOUT   DD SYSOUT=*

See the equivalent Korn shell script on the next page --->

See the execution command, the console log,& sample report 2 pages ahead --->

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

2F2. Korn shell script to execute demo COBOL

 k#001 #!/bin/ksh
 k#002 ##JAR100   JOB  'TEST MVS2UNIX CONVERSION',DATE=20080323
 k#003 export jobid2=jar100 JOBID2=JAR100; scriptpath="$0"; args="$*"
 k#004 if [[ -z "$jobid1" ]]; then export jobid1=$jobid2; fi
 k#005 for arg in $args; do if [[ "$arg" == *=* ]]; then export $arg; fi; done
 k#006 integer JCC=0 SCC=0 LCC=0  # init step status return codes
 k#007 autoload jobset51 jobend51 jobabend51 logmsg1 logmsg2 stepctl51
 k#008 autoload exportfile exportgen0 exportgen1 exportgen2 exportgenall exportgenx
 k#009 . $APPSADM/env/stub.ini  #<-- for control-M (see notes in env/stub.ini)
 k#010 jobset51    # call function for JCL/script initialization
 k#011 goto
 k#012 S0000=A
 k#013 # * CUSTOMER NAME & ADDRESS LIST (WITH DATE & RPT HDNGS)
 k#014 #1======================= begin step#S0010 CAR100 ========================
 k#015 S0010=A
 k#016 stepctl51;
 k#017 goto
 k#018 export JSTEP=S0010; ((XSTEP+=1)); SCC=0; alias goto="";
 k#019 logmsg2 "******** Begin Step $JSTEP car100 (#$XSTEP) ********"
 k#020 ##STEP010  EXEC PGM=CAR100,PARM=2008
 k#021 export PROGID=car100
 k#022 export PARM="2008"
 k#023 exportfile  CUSTMAS data1/ar.customer.master
 k#024 exportfile  NALIST data1/ar.customer.nameadrs.list100
 k#025 exportfile SYSOUT $SYOT/${jobid2}_${JSTEP}_SYSOUT_$(date +%y%m%d_%H%M%S)
 k#026 logmsg2 "Executing--> cobrun $ANIM $CBLX/car100"
 k#027 #3----------------------------------------------------------------------
 k#028 cobrun $ANIM $CBLX/car100
 k#029 #4----------------------------------------------------------------------
 k#030 SCC=$?; S0010C=$SCC; ((JCC|=SCC)); S0010R=1; alias goto="";
 k#031 logmsg2 "SCC = $SCC"
 k#032 if ((SCC>4 || SCC<0))
 k#033    then logmsg2 "ERR: step#$JSTEP car100 abterm $SCC"
 k#034    alias goto="<<S9900=\A"; fi
 k#035 goto
 k#037 #8======================================================================
 k#038 S9000=A
 k#039 jobend51 #move any new GDG files from jobtmp to intended outdirs
 k#040 logmsg2 "JobEnd=Normal, JCC=$JCC, StepsExecuted=$XSTEP, LastStep=$JSTEP"
 k#041 exit 0 #ver:20160212 a2b0c0d1e2f0g1h1i15j0k15l1m4n3o8p0q0r0s2t1u1v0w0x0y1z1
 k#042 #9======================================================================
 k#043 S9900=A
 k#044 jobabend51 #report GDGs NOT moved from jobtmp/subdirs to outdirs
 k#045 logmsg2 "JobEnd=AbTerm, JCC=$JCC,Steps=$XSTEP/$JSTEP" RV ACK
 k#046 exit $JCC  # JCL converted to ksh by UVSW jclunix51 20160215:123756

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

2G1. COBOL Conversion Illustrated & Explained

executing the demo JCL/script & COBOL program


 #1. jar100.ksh     <-- command to execute JCL/script & COBOL program
     ==========
 151026:113802:jar100: Begin Job=jar100
 151026:113802:jar100: /home/mvstest/testlibs/jcls/jar100.ksh
 151026:113802:jar100: Arguments: jar100.ksh
 151026:113802:jar100: ProcessID=15786
 151026:113802:jar100: RUNDATE=20151026
 151026:113802:jar100: RUNLIBS=/home/mvstest/testlibs
 151026:113802:jar100: RUNDATA=/home/mvstest/testdata
 151026:113802:jar100: JTMP=jobtmp/jar100
 151026:113802:jar100: SYOT=sysout/JAR100
 151026:113802:jar100: LOGNAME=mvstest TESTPROD=T000
 151026:113802:jar100: HOSTNAME=uvsoft5.uvsoftware.ca
 151026:113802:jar100: ******** Begin Step S0010 car100 (#1) ********
 151026:113802:jar100: file: CUSTMAS=data1/ar.customer.master fsize=8K
 151026:113802:jar100: file: NALIST=data1/ar.customer.nameadrs.list100 fsize=4K
 151026:113802:jar100: file: SYSOUT=sysout/JAR100/jar100_S0010_SYSOUT_151026_113802 fsize=0K
 151026:113802:jar100: Executing--> cobrun -F /home/mvstest/testlibs/cblx/car100
 151026:113802:JAR100: StepTimes: S0010 car100 Begun=11:38:02 End=11:38:02 Elapsed=00:00:00
 151026:113802:JAR100: Job Times: Begun=11:38:02 NormalEnd=11:38:02 Elapsed=00:00:00
 151026:113802:jar100: JobEnd=Normal, JCC=0, StepsExecuted=1, LastStep=S0010

sample input record


 #2. uvhd data1/ar.customer.master r256
     ==================================
                      10        20        30        40        50        60
 r#        1 0123456789012345678901234567890123456789012345678901234567890123
           0 130140    EVERGREEN MOTORS LTD.    1815 BOWEN ROAD          NANA
             3333332222454545444244545524542222233332445442544422222222224444
             130140000056527255E0DF4F230C44E0000181502F75E02F140000000000E1E1
          64 IMO          BC V9S1H1    250-754-5531 LARRY WRENCH     ..4V|...
             4442222222222442535343222233323332333324455525544442222201357000
             9DF00000000002306931810000250D754D55310C12290725E38000000246C000
         128 .........W0....`........)X}..f3.....\.................4V}...f...
             0000000005300016000000002570063100095000000000000000013570016000
             0C0000C0270D0540C0000C0098D0263C0444C0000C0000C0000C0246D0056C00
         192 ...............................f.....<........f.C 19950531
             0000008900000000880000000018000680001300000000694233333333222222
             00C0026C0000C0023C0000C0083C0056D0012C0000C0016D3019950531000000
Note
  • the 1st record of the input datafile is shown above
  • we must use 'uvhd' because of the packed decimal fields
  • uvhd displays data in vertical hexadecimal 64 byte segments
  • each segment displayed on 3 lines (characters, zones, digits)

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

2G2. COBOL Conversion Illustrated & Explained

jar100/car100 - sample output report


 #3. vi data1/ar.customer.nameadrs.list100
     =====================================

CAR100: CUSTOMER NAME & ADDRESS LIST 080322

 130140    EVERGREEN MOTORS LTD.    1815 BOWEN ROAD          NANAIMO          BC V9S1H1
 132588    GEECOE GENERATOR SERVICESUNIT 170 - 2851 SIMPSON  RICHMOND         BC V6X2R2
 139923    JOHNSTONE BOILER & TANKS 1250 EAST PENDER STREET  VANCOUVER        BC V5L1W1
 142175    LILLY ELECTRIC (1973) LTD16809 - 24TH AVENUE      SURREY           BC V4B5E7
 145264  D MAGRATH SUPPLIES LTD.    1939 KIRSCHNER ROAD      KELOWNA          BC V1Y4N7
 147615  X O'CONNER R.V. CENTRE     44430 YALE ROAD WEST     CHILLIWACK       BC V2P6J1
 149304    POINT GREY GOLF & COUNTRY3350 S.W. MARINE DRIVE   VANCOUVER        BC V6N3Y9
 150825    RIGGERS INDUSTRIAL       960 - 6TH AVENUE         HOPE             BC
 152355    SHAW, JOHN               477 CARIBOO CRES.        PORT COQUITLAM   BC V3M1X1
 154688    TAURUS RESOURCES         1110 - 625 HOWE STREET   VANCOUVER        BC V6C2T6
 157352  D WHYTE, W.                1150 LODGE ROAD          NORTH VANCOUVER  BC V7R1W8
 173320  X ZENITH TRANSPORT         2381 ROGERS AVE          COQUITLAM        BC V3K5Y2
 201120    ALLTYPE RENTAL LTD.      BOX 1819                 DRAYTON VALLEY   AL T0E0M0
 204700    CASE POWER EQUIPMENT     12611-100 ST             GRANDE PRAIRIE   AL T8V4H2
 208060    E&L TRUCKING             LAND & CATTLE LTD        WARBURG          AB T0C2T0
 211140  D FORD NEW HOLLAND         BOX 1, 440 ELLIS ROAD    WINTERBURN       AB T0E2N0
 223240  X NICHOLSON CHEVROLET LTD. 7215 ARGYLL ROAD         EDMONTON         AL T6C4J2
 224700    OTTO MOBILES WESTERN LTD.8441 CORONET ROAD        EDMONTON         AL T6E4N7
 231550    SPARROW ELECTRIC CO. LTD.BOX 88                   NISKU            AL T0C2G0
 234300    TERRITORIAL REWIND       BPX 1648                 YELLOWKNIFE      NW X1A2P2
 237286    WEBER, TOM               BOX 5503                 FORT MCMURRAY    AL T9H3G5
 301120  D ALBERTA GAS CHEMICALS LTD3RD. FLOOR, 11456 JASPER EDMONTON         AL T5K0M1
 306959  X 356582 ALBERTA LTD.      DEVITT NURSERY           CALGARY          AL T2T5N1
 308685    FOOTHILLS ELECTRIC       3932 - 3A ST. N.W.       CALGARY          AL T2E6R4
 313720    MONITREX ENGINEERING LTD 7-2280-39 AVE, N.E.      CALGARY          AL T2E6P7
 315512    PARTS PLUS               BOX 510 MAIN ST          THREE HILLS      AB T0M2A0
 318833    TOP NOTCH CONSTRUCTION   BOX 308, STN J           CALGARY          AL T2A4X6
 400002    ACKLANDS LTD             945 -2ND AVE             PRINCE GEORGE    BC V2L3A7
 401210    COAST RANGE CONSTRUCTION 1103-207 W. HASTINGS ST  VANCOUVER        BC V6B1H7
 402875    HULL, DON & SONS LTD.    BOX 1297                 PRINCE GEORGE    BC V2L4V3
 403887  D MILNER, LARRY            BOX 28 RAU ROAD R.R.8    QUESNEL          BC V2J5E6
 406082    PRECAM RENTALS LTD:      10116-94TH AVE           FORT ST. JOHN    BC V1G5G6

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

2H1. COBOL Conversion Illustrated & Explained

SYSIN/SYSOUT optional conversion

 cbl0------->cbl1------->cbl2------>cbl3------->cbl4-------->cbls------->cblx
     cleanup     convert     sysin1     sysout1     copy(cp)     compile
                             |------ optional -----|

If you do not have Micro Focus COBOL, you will need to run 2 extra conversion jobs (sysin1 & sysout1).

'sysin1' will copy the programs inserting a datafile to convert "ACCEPTs from instream data(SYSIN)" to "READs from a datafile".

'sysout1' will copy the programs inserting a datafile to convert "DISPLAYs upon "SYSOUT" to "WRITEs to a datafile".

Please these jobs & a sample program conversion begining on page '2G1'.

Micro Focus COBOL provides for "ACCEPTs from SYSIN" via option INDD(SYSIN) and for "DISPLAYs upon SYSOUT" via option OUTDD(SYSOUT). Please see the COBOL compile options file listed on page '5D1'.

In case you need it, the 'sysin1/sysout1' optional conversions are documented on the following pages:

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

2H2. COBOL Conversion Illustrated & Explained

SYSIN/SYSOUT & MFC options INDD/OUTDD

Micro Focus COBOL has options to support mainframe 'ACCEPT from SYSIN' and 'DISPLAY upon SYSOUT'. See the INDD & OUTDD options in the ctl/cobdirectives file listed on page '5D1'. Here is a short COBOL program to test these options.

car300.cbl - test INDD & OUTDD

        identification division.
       * car300 - test mainframe conversion to micro focus cobol
       * - this program tests accept from sysin & display upon sysout
       * - see directives indd & outdd in /home/uvadm/ctl/cobdirectives
       *   (-c indd(sysin) & -c outdd(sysout)
       * - cause micro focus to treat sysin & sysout as external files
       * use extra conversion jobs if you don't have micro focus cobol
       * - sysin1 replaces 'ACCEPT's with 'READ's from a file
       * - sysout1 replaces 'DISPLAY's with 'WRITE's to a file
        program-id. car300.
        environment division.
        input-output section.
        file-control.
        data  division.
        file section.
        working-storage section.
        01  sysinrec             pic x(80).
        01  sysoutrec            pic x(132).
        procedure division.
        mainline.
            accept sysinrec from sysin.              <-- Note#1
            if sysinrec (1:2) = "/*"
               stop run returning 0
            else
               move sysinrec to sysoutrec
               display sysoutrec upon sysout         <-- Note#2
               go to mainline.

Notes re SYSIN & SYSOUT

See the JCL/script used to execute this program, listed on the next page --->

  1. Please relate 'accept sysinrec from sysin' to the SYSIN file defined in the script via 'export SYSIN=...'

  2. Please relate the 'display sysoutrec upon sysout' to the SYSOUT file defined in the script via 'export SYSOUT=...'

  3. The INDD & OUTDD options cause Micro Focus COBOL to assume that SYSIN & SYSOUT files will be external files (defined via 'export's).

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

2H3. COBOL Conversion Illustrated & Explained

Here is the JCL & the converted script to test the COBOL program shown on the previous page. We have omitted some front-end & back-end code from the Korn shell script. Please see JCLcnv4gdg.htm to see those details.

jar300.jcl - test COBOL car300.cbl

 //JAR300   JOB  'TEST MVS JCL & COBOL CONVERSION - SYSIN & SYSOUT'
 //* - ctl/cobdirectives includes -C INDD "SYSIN" & -C OUTDD "SYSOUT"
 //* - program CAR300 tests ACCEPT from SYSIN & DISPLAY UPON SYSOUT
 //STEP010  EXEC PGM=CAR300
 //SYSOUT   DD SYSOUT=*
 //SYSIN    DD *
 01 sysin test data line #01
 02 sysin test data line #02
 03 sysin test data line #03
 EOD
 /*

jar300.ksh - script equivalent of JCL above

 k#015 #1======================= begin step#S0010 CAR300 ========================
 k#016 S0010=A
 k#017 stepctl51;
 k#018 goto
 k#019 export JSTEP=S0010; ((XSTEP+=1)); SCC=0; LCC=0; alias goto="";
 k#020 logmsg2 "******** Begin Step $JSTEP car300 (#$XSTEP) ********"
 k#021 ##STEP010  EXEC PGM=CAR300
 k#022 export PROGID=car300
 k#023 export PARM=""
 k#024 exportfile SYSOUT $SYOT/${jobid2}_${JSTEP}_SYSOUT_$(date +%y%m%d_%H%M%S)
 k#025 exportfile SYSIN $JTMP/${JSTEP}_${PROGID}_SYSIN
 k#026 cat > $SYSIN <</*
 k#027 01 sysin test data line #01
 k#028 02 sysin test data line #02
 k#029 03 sysin test data line #03
 k#030 EOD
 k#031 /*
 k#032 logmsg2 "Executing--> cobrun $ANIM $CBLX/car300"
 k#033 #3----------------------------------------------------------------------
 k#034 cobrun $ANIM $CBLX/car300
 k#035 #4----------------------------------------------------------------------

Notes re SYSIN & SYSOUT

Note the 'export SYSIN=...' & 'export SYSOUT=...' in the JCL/script above. Micro Focus COBOL options INDD & OUTDD causes these files to be used by the 'accept' & 'display' statements in the COBOL program on the previous page.

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

2H4. COBOL Conversion Illustrated & Explained

Alternatives to INDD & OUTDD

I believe that only Micro Focus COBOL has the INDD & OUTDD options to cause 'ACCEPTs from SYSIN' & 'DISPLAYs upon SYSOUT' to use the external files defined by exports for SYSIN & SYSOUT.

For customers that do not have Micro Focus COBOL, the Vancouver Utilities includes uvcopy utility jobs 'sysin1' & 'sysout1' which will insert file definitions into the COBOL source programs.

sysin1 will convert 'accepts from sysin' to 'reads' from a real file with external name SYSIN. sysout1 will convert 'displays upon sysout' to 'writes' to a real file with external name SYSOUT.

We will need to modify the conversion operating instructions. We will need to setup some additional subdirs (cbl3 & cbl4) for sysin1 & sysout1 to copy the COBOL programs while making the changes.

directories for sysin1 & sysout1

 :-----testlibs           <-- testlibs/prodlibs
 :     :-----cbl0     COBOL - original mainframe BATCH programs
 :     :-----cbl1           - cleanup (drop CRs, clear 1-6/73-80, lowercase)
 :     :-----cbl2           - cnvMF4/cnvMF5 VSE/MVS basic conversion
 :     :-----cbl3           - sysin1 convert ACCEPT from SYSIN to a file
 :     :-----cbl4           - sysout1 convert DISPLAY upon SYSOUT to a file
 :     :-----cbls           - copy here for compiles & manual edits
 :     :-----cblx           - compiled output (.int .idy .cbl .err)
 :     :-----cblst          - compiler listings
 :     :-----cpy0     Copybooks - original mainframe source
 :     :-----cpy1           - cleanup (drop CRs, clear 1-6/73-80, lowercase)
 :     :-----cpy2           - cnvMF4/cnvMF5 VSE/MVS basic conversion
 :     :-----cpys           - copy here for compiles & manual edits
 :     :-----ctl      Control files (cnvcob5.tbl, cobdirectives)

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

2H5. COBOL Conversion Illustrated & Explained

Op-Instrns revised for sysin1 & sysout1

Here are the conversion Operating Instructions with changes to include the 'sysin1' & 'sysout1' utility jobs.


 #2. uvcopyx cleanup cbl0 cbl1 uop=q0i7c5e15g8j1k1l1n1s8t1,arg1=.cbl
     ===============================================================
     - cleanup COBOL programs from mainframe
     - remove CR's, clear cols 1-6 & 73-80, translate to lower (not in quotes)
     - shorten text back to last non-blank, ensure output filenames in lowercase

 #3. uvcopy cnvMF5,fild1=cbl1,fild2=cbl2,fili3=ctl/cnvcob5.tbl,uop=q0i7m1
     ====================================================================
            - convert MVS COBOL programs for Unix/Linux Micro Focus compiler

 #4.  uvcopyx sysin1 cbl2 cbl3 uop=q0i7                   - optional
      =================================
            - convert ACCEPT's from control streams to READ's from a file

 #5.  uvcopyx sysout1 cbl3 cbl4 uop=q0i7                   - optional
      ==================================
            - convert DISPLAY's upon SYSOUT to WRITE's to a file

 #6. cp cbl4/* cbls            - copy converted programs to 'cbls'
     ==============              before compiles & any manual changes

 #7. mfcblA all cbls cblx cpys - compile all programs
     =========================

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

2H6. car300.cbl - after sysin1 & sysout1

        identification division.
       * car300 - test mainframe conversion to micro focus cobol
       * - this program tests accept from sysin & display upon sysout
       * - see directives indd & outdd in /home/uvadm/ctl/cobdirectives
       *   (-c indd(sysin) & -c outdd(sysout)
       * - cause micro focus to treat sysin & sysout as external files
       * use extra conversion jobs if you don't have micro focus cobol
       * - sysin1 replaces 'ACCEPT's with 'READ's from a file
       * - sysout1 replaces 'DISPLAY's with 'WRITE's to a file
        program-id. car300.
        environment division.
        input-output section.
        file-control.
 uvD        select sysout1 assign external SYSOUT
 uvD                       organization is line sequential.
 uvC        select sysin1 assign external SYSIN
 uvC                       file status is sysin1-fstatus
 uvC                       organization is line sequential.
        data  division.
        file section.
 uvD    fd  sysout1.
 uvD    01  sysout1rec      pic    x(144).
 uvC    fd  sysin1.
 uvC    01  sysin1rec         pic    x(80).
        working-storage section.
 uvC    01  sysin1-fstatus    pic    x(2).
 uvJ    01   jobid      pic  x(8).
        01  sysinrec             pic x(80).
        01  sysoutrec            pic x(132).
        procedure division.
 uvD    opensysout1.
 uvD        open output sysout1.
 uvC    opensysin1.
 uvC        open input sysin1.
 uvC        if sysin1-fstatus > "00"
 uvD        move spaces to sysout1rec
 uvD        string "SYSIN OPEN ERR, FSTATUS = " sysin1-fstatus
 uvD        delimited by SIZE into sysout1rec
 uvD        write sysout1rec
 uvC           stop run returning sysin1-fstatus.
 uvJ        display "JOBID2" upon environment-name
 uvJ        accept jobid from environment-value.
        mainline.
 uvC   *    accept sysinrec from sysin.
 uvC        read sysin1
 uvC        move function upper-case (sysin1rec) to sysinrec.
            if sysinrec (1:2) = "/*"
               stop run returning 0
            else
               move sysinrec to sysoutrec
 uvD        move spaces to sysout1rec
 uvD        string sysoutrec
 uvD        delimited by SIZE into sysout1rec
 uvD        write sysout1rec
               go to mainline.

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

2H7. COBOL Conversion Illustrated & Explained

Problem - OUTDD not working ??

There was a bug in the OUTDD "SYSOUT" feature in early releases of Micro Focus COBOL Server Express 4.0 for Red Hat Enterprise 3.0. This bug was fixed by service pack 1 (available in summer 2004).

Directive OUTDD caused programs to hang.

A temporary workaround is to use the 'sysout1' utility job (documented on the previous pages) & to specify NOOUTDD in the COBOL compile options file (listed on page '5D1'.

 -C NOOUTDD "SYSOUT"

Note that the INDD "SYSIN" option works great, so the 'sysin1' utility job is not required for Micro Focus COBOL sites.

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

Part_3 COBOL conversion Problems & Solutions

Part 3 CONTENTS


3A1. ACCEPTing DATE from JCL to COBOL
- 'ACCEPT from DATE' does not work the same on unix as it did on mainframe
- modifying COBOL programs to ACCEPT RUNDATE different from system date

3B1. Providing various DATE formats via unixwork1.cpy/unixproc1.cpy
- COBOL converter inserts copybooks & 'perform unixproc1' at proc-div

3C1. PARM data retrieval from mainframe JCL EXEC to COBOL program
- solved by Micro Focus COBOL ability to accept environmental variables

3D1. PARM data retrieval from mainframe JCL EXEC to COBOL program
- alternate solution via C subroutine linked with COBOL runtime (rts32)
- preferred method of using C subrtns since we can still animate

3E1. PARM data retrieval from mainframe JCL EXEC to COBOL program
- replacement for mainframe PROCEDURE DIVISION USING PARM-DATA-FROM-EXEC
- C subroutine to store parm-length & parm-data in LINKAGE SECTION

3F1. Executing fully linked COBOL programs vs .int's
 .int's usually adequate
- fully linked required for C subroutines
- faster execution, usually noticeable only if a lot of table indexing

3G1. Demo compile/link COBOL programs with called programs in lib archive
 getdate.cbl - called program, compiled & archived into lib/called.a
  with script 'mfcbl1o'
 car115.cbl - calling program, compiled with script 'mfcbl1y'
  - fully linked to an executable (no .extension vs .int)
- could accept date in cobol, but this demos scripts mfcbl1o & mfcbl1x
- might need to replace called assemblers with cobol

3H1. Test File Locking for Micro Focus COBOL
- using demo program car150.cbl & 2 JCLs (jar150.jcl & jar155.jcl).

3I1. datetest.cbl - demo calling a script from a COBOL program
- get system date & store value in environment-variable RUNDATE
- then call a script which will display the value of RUNDATE
- demos that environment values can be passed from parent to child
- But not from child to parent (child cant affect parent environment)

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

3A1. COBOL Conversion - Problems & Solutions

ACCEPTing DATE from JCL to COBOL

'ACCEPT FROM DATE' does not work the same on unix/linux as on MVS or VSE.

On VSE the JCL could use '// DATE' to set a date that would be delivered by COBOL 'ACCEPT FROM DATE'.

On MVS the // JOB card could specify DATE=... for any COBOL 'ACCEPT from DATE'. DATE=... could be hard-coded or it might be a &SYMBOL entered by the operator or by a scheduler.

ON unix/linux 'ACCEPT FROM DATE' always gets the current system date.

The sample program 'car100.cbl' on page '2D1' illustrates 'ACCEPT FROM DATE' & the corresponding JCL 'JAR100.jcl' on page '2F1' illustrates the '// DATE'.


      ACCEPT RUN-DATE FROM DATE.  <-- line 31 CAR100.cbl page '2D1'
      ==========================

 // DATE 03/20/08                 <-- line 3 JAR100.jcl page '2F1' (VSE only)
 ================

 // JOB ...,DATE=...             <-- for MVS
 ===================

 export RUNDATE=03/20/08          <-- VSE JCL converter converts to this
 =======================            - see line 22 jar100.ksh page '2F2'

 export DATE=03/20/08             <-- why not convert to this ?
 ====================

On VSE, the JCL converter converts '// DATE' to 'export RUNDATE' because 'export DATE' will NOT work. COBOL 'ACCEPT FROM DATE' always gets the current system date, NOT the environmental variable 'DATE'.

On MVS DATE might be specified on // JOB ...,DATE=...

The JCL converter converts 'DATE to 'RUNDATE' to eliminate any misconception that 'accept from DATE' would work.

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

3A2. COBOL Conversion - Problems & Solutions

modifying COBOL to 'ACCEPT RUNDATE'

We will now illustrate how we can modify the COBOL program to 'ACCEPT RUNDATE' using the 'export'ed environmental-value from the JCL/script.

Please study the sample COBOL & JCL on the following pages & locate the lines listed below:


2D1. CAR100.cbl <-- mainframe COBOL with 'ACCEPT from DATE'
3A3. car110.cbl <-- converted/modified to ACCEPT from 'ENVIRONMENTAL-VALUE'
3A4. JAR110.jcl <-- mainframe JCL with '// DATE' (VSE not MVS)
3A5. jar110.ksh <-- converted script to 'export RUNDATE'

 export RUNDATE=03/20/08            <-- line 21 jar110.ksh page '3A5'
 =======================

      DISPLAY 'RUNDATE' UPON ENVIRONMENT-NAME.  <-- line 32 car110.cbl '3A3'
      ========================================
      ACCEPT RUN-DATE FROM ENVIRONMENT-VALUE.   <-- line 33 car110.cbl '3A3'
      ========================================

Micro Focus COBOL provides the above mechanism to accept the 'VALUE' of any environmental variable (NAME), that has been 'export'ed by the JCL/script or from the console command before executing the COBOL program.

The apparent conclusion is that we would have to modify all converted COBOL programs to insert the above 2 lines (DISPLAY/ACCEPT) to get the value of any 'RUNDATE' 'export'ed by the JCL/script.

BUT, after the sample illustrations, we will show you that you do not have to manually insert the 'DISPLAY/ACCEPT upon/from ENVIRONMENTAL-NAME/VALUE'. The COBOL conversion provides this automatically by inserting copybooks unixwork1.cpy (listed on '2E3'), unixproc1.cpy (listed on '2E4'), and 'perform'ing unixproc1 at the begining of the procedure division.

Also note that the JCL converter inserts a call to the jobset51 function (listed at JCLcnv4gdg.htm#5K1) at the begining of converted scripts & it includes the following at line #129


 if [[ -z "$RUNDATE" ]]; then RUNDATE=$(date +%Y%m%d); fi; export RUNDATE
 ========================================================================

So RUNDATE defaults to the system date, but operator can override by entering:


 --> jar100.ksh RUNDATE=03/20/08  <-- change date for current job
     ===========================

 --> export RUNDATE=03/20/08   <-- change date for all future jobs
     =======================     - until another export RUNDATE or logoff

 --> jar100.ksh                <-- future jobs will get changed date
     ==========

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

3A3. modifying COBOL to 'ACCEPT RUNDATE'

car110.cbl - demo 'ACCEPT from ENVIRONMENTAL-VALUE'

 000010 identification division.
 000020* car110 - test/demo mainframe conversion to micro focus cobol
 000030* - customer n&a list with report hdng & date via accept env-var
 000040* - see 'ACCEPT RUN-DATE FROM ENVIRONMENT-VALUE' in procedure
 000050 program-id. car110.
 000060 environment division.
 000070 input-output section.
 000080 file-control.
 uvM   * select custmas assign custmas
 uvM        select custmas assign external custmas
 000100            organization record sequential access mode sequential.
 uvM   * select nalist assign nalist
 uvM        select nalist assign external nalist
 uvM               organization line sequential.
 000130 data  division.
 000140 file section.
 000150 fd  custmas record contains 256 characters.
 000160     01 cm1. copy "custmas.cpy".
 000170 fd  nalist record contains 120 characters.
 000180     01 listrec.
 000190        05 list-cust       pic 9(6).
 000200        05 list-delete     pic x(4).
 000210        05 list-nameadrs   pic x(80).
 000220 working-storage section.
 uvM    copy "unixwork1.cpy".                   <-- see expansion on page '2E3'
 000230 01  page-hdngs.
 000240     05 filler            pic x(40) value
 000250        'CAR110: CUSTOMER NAME & ADDRESS LIST'.
 000260     05 run-date          pic x(20) value spaces.
 000270     05 filler            pic x(60) value spaces.
 000280 01  cm1-eof              pic x value ' '.
 000290*
 000300 procedure division.
 uvM        perform unixproc1.              <-- see unixproc1.cpy at end program
 000310 mainline.
 000320     display 'RUNDATE' upon environment-name.  <-- 2 lines replace
 000330     accept run-date from environment-value.   <-- ACCEPT from DATE
 000340     open input custmas. open output nalist.
 000350     write listrec from page-hdngs before advancing 2 lines.
 000360     read custmas at end move '1' to cm1-eof.
 000370     perform dtlrtn until cm1-eof = '1'.
 000380     close custmas nalist.
 000390     stop run returning 00.
 000400 dtlrtn.
 000410     move spaces to listrec.
 000420     move cm-cust to list-cust.
 000430     move cm-delete to list-delete.
 000440     move cm-nameadrs to list-nameadrs.
 000450     write listrec before advancing 1 line.
 000460     read custmas at end move '1' to cm1-eof.
 uvM    copy "unixproc1.cpy".                  <-- see expansion on page '2E4'

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

3A4. modifying JCL for COBOL 'ACCEPT RUNDATE'

DATE Problem Reminder


 // JOB ...,DATE=...         <-- mainframe JCL can set date for COBOL
 ===================

 // DATE 03/20/08            <-- mainframe VSE JCL can set date for COBOL
 ================               - see line 3 JAR100.jcl page VSEJCL.htm#2F1

 ACCEPT RUN-DATE FROM DATE.  <-- mainframe COBOL gets job date vs system date
 ==========================    - see line 31 CAR100.cbl page '2D1'

Above does not work for COBOL on unix/linux (always gets system date). Prior pages suggested an alternate solution as follows:


 export RUNDATE=03/20/08     <-- JCL/script could export RUNDATE as desired
 =======================       - see line 22 jar100.ksh page '2F2'

You could add following 2 lines at begin PROCEDURE DIVISION of COBOL programs to capture the RUNDATE environmental variable.

      display 'RUNDATE' upon environment-name.
      accept run-date from environment-value.

BUT, in fact the JCL & COBOL converters do this for you automatically, except it is not as obvious as the above suggests.


 export RUNDATE=system-date  <-- hidden in 'jobset51' (called at begin scripts)
 ==========================

 export RUNDATE=03/20/08     <-- operator can override the default
 =======================
      display 'RUNDATE' upon environment-name.  <-- hidden in unixproc1.cpy
      accept run-date from environment-value.     - called at begin PROC DIV

'unixproc1.cpy' gets RUNDATE & SYSDATE, and stores them in many different formats in 'unixwork1.cpy' (ymd,mdy,dmy, 6&8 digits). So you could change COBOL program as follows:


 ACCEPT RUN-DATE FROM DATE.      <-- mainframe COBOL
 ==========================        - see line 31 CAR100.cbl page '2D1'

 move rundate-mdy6 to run-date   <-- change converted COBOL to this
 =============================

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

3A5. modifying JCL for COBOL 'ACCEPT RUNDATE'

grep for all instances of 'from date'

You might want to find all occurrences of 'ACCEPT RUN_DATE FROM DATE', review, & possibly change some of them similar to the above. You could find all occurrences with 'grep'. There are several Vancouver Utility pre-programmed jobs that migt help you with search/replace projects such as this.

 CNVaids.htm#8M1 - uvcopy 'grepx1' will reformat grep output into 'vi' commands
                   - to save you a lot of keystrokes
                   - vi allows you to review, change some, not others
 SCANjobs.htm#E1 - uvcopy 'scan1d' will extract all occurrences of 'from date'
                     from all files in the directory, print for review & change
 REPjobs.htm#E0 - uvcopy 'rep1d' could make the changes automatically
                  - but probably would not want to in thisc ase

jar110.jcl - JCL to demo 'ACCEPT from ENVIRONMENT'

 // JOB  JAR110   TEST MVS JCL CONVERSION TO UNIX/LINUX KORN SHELL       00000010
 *                    DEMO set 'run-date' different from 'system-date'   00000020
 // DATE 03/20/08  *<-- // DATE on VSE OK for COBOL 'ACCEPT FROM DATE'   00000030
 *  - NOT unix/linux, CAR110.cbl modified to 'accept from environment'   00000040
 *  '// DATE ...' converted to 'export RUNDATE=...' for accept from env  00000050
 *  alternative - unixproc1.cpy allows entry on run cmd vs hard-code ??  00000060
 // DLBL CUSTMAS,'AR.CUSTOMER.MASTER',,VSAM,CAT=UCAT01                   00000070
 // DLBL NALIST,'AR.CUSTOMER.NAMEADRS.LIST110',0,SD                      00000080
 // EXTENT SYS017,DYNWRK,1,0,1,10                                        00000090
 // EXEC PGM=CAR110,SIZE=AUTO                                            00000100
 /&                                                                      00000110

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

3A6. modifying JCL for COBOL 'ACCEPT RUNDATE'

jar110.ksh - converted script demo 'ACCEPT from ENVIRONMENT'

 #!/bin/ksh
 ##JOB  JAR110   TEST VSE JCL CONVERSION TO UNIX/LINUX KORN SHELL
 export JOBID2=JAR110 jobid2=jobidx; scriptpath="$0"; args="$*"
 if [[ -z "$JOBID1" ]]; then export JOBID1=$JOBID2; fi
 for arg in $args; do if [[ "$arg" == *=* ]]; then export $arg; fi; done
 integer JCC=0 SCC=0 LCC=0  # init step status return codes
 autoload jobset51 gdgclear51 jobend51 jobabend51 logmsg1 logmsg2 stepctl51
 autoload exportfile exportgen0 exportgen1 exportgen2 exportgenall exportgenx
 jobset51    # call function for JCL/script initialization
 goto
 S0000=A
 #1======================== begin step#S0010_CAR110 =========================
 S0010=A
 stepctl51;  #calc StepTimes & check jobstop/goto end
 goto
 export JSTEP=S0010; ((XSTEP+=1)); SCC=0; LCC=0; alias goto="";
 JSTEP=S0010; ((XSTEP+=1)); SCC=0; LCC=0;
 logmsg2 "******** Begin Step $JSTEP car110 (#$XSTEP) ********"
 export PROGID=CAR110
 export PARM="";
 exportfile SYSOUT $SYOT/${JOBID2}_${JSTEP}_${PROGID}
 logmsg1 "                   DEMO set 'run-date' different from 'system-date'"
 export RUNDATE=03/20/08
 logmsg1 " - NOT unix/linux, CAR110.cbl modified to 'accept from environment'"
 logmsg1 " '// DATE ...' converted to 'export RUNDATE=...' for accept from env"
 logmsg1 " alternative - unixproc1.cpy allows entry on run cmd vs hard-code ??"
 exportfile CUSTMAS data1/ar.customer.master
 exportfile NALIST data1/ar.customer.nameadrs.list110
 ## EXEC PGM=CAR110,SIZE=AUTO
 logmsg2 "Executing--> cobrun $ANIM $CBLX/car110"
 #3----------------------------------------------------------------------
 cobrun $ANIM $CBLX/car110
 #4----------------------------------------------------------------------
 LCC=$?; S0010C=$LCC; ((SCC+=LCC)); ((JCC+=LCC)); alias goto="";
 if ((SCC != 0))
    then logmsg2 "ERR: step $JSTEP CAR110 abterm $SCC"
    alias goto="<<S9900=A"; fi
 goto
 #8======================================================================
 S9000=A
 #move any new GDG files from jobtmp to RUNDATA/subdirs
 jobend51 $RUNDATA
 logmsg2 "JobEnd=Normal, StepsExecuted=$XSTEP, LastStep=$JSTEP"
 exit 0 #UVSI jclunix41 ver: 20121108 d0e1f1g1i2j1l1p0q1r0s0t12u1y0
 #9======================================================================
 S9900=A
 logmsg2 "JobEnd=AbTerm, JCC=$JCC,StepsX/L=$XSTEP/$JSTEP" RV ACK
 #report GDGs NOT moved from jobtmp/GDG/subdirs to outdirs
 jobabend51 $RUNDATA
 exit $JCC

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

3B1. COBOL Conversion - Problems & Solutions

set DATE via unixwork1.cpy/unixproc1.cpy

The pages above illustrated how you could compensate for the problem that 'ACCEPT from DATE' on unix/linux delivers the current system date & NOT the date from the converted script equivalent of '// DATE ...' (VSE only). On MVS, the DATE might be specified on // JOB ...,DATE=...

Page '3A2' above suggested manually replacing 'ACCEPT from DATE' with 2 lines:


      DISPLAY 'RUNDATE' UPON ENVIRONMENT-NAME.  <-- line 32 car110.cbl '3A3'
      ========================================
      ACCEPT RUN-DATE FROM ENVIRONMENT-VALUE.   <-- line 33 car110.cbl '3A3'
      ========================================

In fact the COBOL converter does include 'DISPLAY/ACCEPT from ENVIRONMENT' on lines 79 & 80 of 'unixproc1.cpy' which is listed on page '2E4'. Note that the converter inserts 'perform unixproc1' at begining of procedure division.

DATE formats provided by unixwork1.cpy/unixproc1.cpy

       * sysdate-ymd8  pic x(8)  = 'ccyymmdd'
       * sysdate-ymd6  pic x(6)  = 'yymmdd'
       * sysdate-mdy8  pic x(8)  = 'mmddccyy'
       * sysdate-mdy6  pic x(6)  = 'mmddyy'
       * sysdate-ymd8e pic x(10) = 'ccyy/mm/dd'
       * sysdate-ymd6e pic x(8)  = 'yy/mm/dd'
       * sysdate-mdy8e pic x(10) = 'mm/dd/ccyy'
       * sysdate-mdy6e pic x(8)  = 'mm/dd/yy'
       * systime-hmsh  pic 9(8)  = 'HHMMSShh'
       * systime-hms6  pic 9(6)  = 'HHMMSS'
       * rundate-ymd8  pic x(8)  = 'ccyymmdd'
     - - - same set of 10 fields repeated for rundates - - -
       * runtime-hms6  pic 9(6)  = 'HHMMSS'

You can use any of these field names in your COBOL programs, but of course that requires a manual change. The COBOL converter search/replace table can be setup to replace some of your frequently used date field names with the desired name/format from the above list. See discussion next page.


 ACCEPT RUN-DATE FROM DATE.      <-- mainframe COBOL
 ==========================        - see line 31 CAR100.cbl page '2D1'

 move rundate-mdy6 to run-date   <-- could change converted COBOL to this
 =============================

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

3B2. set DATE via unixwork1.cpy/unixproc1.cpy

current-date substituted by cnvcob4.tbl

The COBOL converter allows you to code a search/replace table. Here is an example used to replace 'current-date' with 'rundate-mdy6e' mm/dd/yy format. 'current-date' is a reserved word that the VSE COBOL compiler replaced with the date in the mm/dd/yy format. Micro Focus COBOL will substitute current-date if you specify COBOL directive 'OSVS'. Use this search/replace table entry if you need to specify some other compiler compatibility type.

  current-date;~~~~~~~~~~~~~~~~ rundate-mdy6e;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

See sample search/replace table with about 30 entries listed on page '5B2'.

enter RUNDATE as yyyymmdd

unixwork1.cpy & unixproc1.cpy expect the international standard format 'yyyymmdd' to be used when specifying RUNDATE. RUNDATE is then reformatted to a variety of formats that you can use for your COBOL programs.

We recommend you use the conversion opportunity to standardize your date formats to yyyymmdd, at least for the operator entry format.

3 ways to enter RUNDATE


 #1. export RUNDATE=...    <-- 'export RUNDATE' embedded in JCL/scripts
     ==================

 #2. jobxx.ksh RUNDATE=yyyymmdd  <-- operator enters RUNDATE on command line
     ==========================

 #3. export RUNDATE=yyyymmdd   <-- operator enters RUNDATE at begin batch shift
     =======================

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

3B3. set DATE via unixwork1.cpy/unixproc1.cpy

other methods of DATE entry


 #4. // EXEC PROGID,PARM=...    <-- DATE on EXEC PARM=...
     =======================

 #5. Instream DATE embedded in JCL/script (hard-coded)
     =================================================
      // EXEC PROGID
      23/04/08 MARCH 23, 2008     <-- hard-coded (NOT good!)
      /*

 #5a. Instream DATE embedded in JCL/script (&SYMBOLs)
      ===============================================
      // EXEC PROGID
      &SYMBOL                     <-- &SYMBOLs instream
      /*

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

3C1. COBOL conversion Problems & Solutions

PARM-DATA Conversion Solution

Mainframe systems could pass up to 100 bytes of data from the JCL to the COBOL program using the 'PARM' data mechanism. When we convert JCL to Korn shell scripts & mainframe COBOL to Micro Focus COBOL, this feature would be lost without special consideration. The Vancouver Utility converters provide it.

PARM-DATA - Mainframe Method

The following 1 line of JCL & 5 lines of COBOL illustrate the mainframe code required to pass PARM data from the JCL to the program.

 // EXEC PGM=CAR120,SIZE=AUTO,PARM='MARCH 11, 2005'
        LINKAGE SECTION.
        01  PARM-DATA-PKT.
            05 PARM-LTH          PIC 9(4) COMP.
            05 PARM-DATA         PIC X(100).
        PROCEDURE DIVISION USING PARM-DATA-PKT.

PARM-DATA - Vancouver Utility Conversions

Here are the equivalents of the above after conversion using the Vancouver Utility JCL & COBOL converters:

export PARM="MARCH 11, 2005" cobrun $ANIM $CBLX/car120

        working-storage section.
 uvM    copy "unixwork1.cpy".
       *
        linkage section.
        01  parm-data-pkt.
            05 parm-lth          pic 9(4) comp.
            05 parm-data         pic x(100).
       *
        procedure division using parm-data-pkt.
 uvM        perform unixproc1.
 uvP               move parm1-lth to parm-lth.
 uvP               move parm1-data to parm-data.

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

3C2. COBOL conversion Problems & Solutions

Notes re PARM-DATA Conversion

  1. unixproc1 (listed on page '2E4') retrieves parm-data from the JCL/script 'export PARM=...' via display/accept from environmental variable 'PARM'. PARM length & data are stored in parm1-lth & parm1-data fields of unixwork1.cpy (listed on page '2E3').

  2. The converter saves the parm-lth & parm-string fieldnames from the LINKAGE SECTION & generates 'move' stmnts (following perform unixproc1) to move the parm-lth/data from WORKING-STORAGE to LINKAGE SECTION.

  3. You will have to modify the 'move parm1-data to _____' if there are multiple parm-data fields. You might insert a group name & then change the move data destination field to the group name.

        linkage section.
        01  parm-data-pkt.
            05 parm-lth          pic 9(4) comp.         <-- 2 bytes binary
          02  parm-data-group.                          <-- insert group name
            05 parm-data1        pic x(10).
            05 parm-data2        pic x(20).
            05 parm-data3        pic x(70).
 uvM        perform unixproc1.
 uvP               move parm1-lth to parm-lth.
 uvP               move parm1-data to parm-data.         <-- was parm-string
  1. Note that we cannot move to the '01 parm-data-pkt' group name, because the parm1-lth (in unixwork1.cpy) is 4 bytes numeric characters, but the linkage section '05 parm-lth' is a 2 byte comp/binary field (or you could remove the 'comp' to make it match).

        01 unixwork1.
             ...........
            05 parm1-lth          pic s9(4).            <-- 4 bytes num char
            05 parm1-data         pic x(200).
  1. The following listings will help you understand this:


    3C3. car120.cbl - COBOL program to demo parm-data conversions

    2E1. unixwork1.cpy/unixproc1.cpy - inserted into all converted COBOL programs
    Why you need unixwork1/unixproc1 ?
    (SYSDATEs/RUNDATEs, store PARM data, decode file status, SQL connect)

    2E3. unixwork1.cpy - copybook inserted at WORKING-STORAGE

    2E4. unixproc1.cpy - copybook inserted at end of program

    3C4. Operating Instructions to compile & execute the demo program
    - and observe the report created
    - with date passed as PARM data from JCL/script to COBOL program

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

3C3. COBOL demo 'car120.cbl' for PARM data

        identification division.
       * car120 - test mainframe conversion to micro focus cobol
       * - capture parm-data from jcl // exec program,parm=xxx
       * converter looks for linkage section parm... lth comp
       * - saves parm-lth & parm-data fieldnames for moves at proc div
       * at procedure division converter inserts perform unixproc1
       * - displays "PARM" upon env-var, accepts parm-data1 from env-var
       * - unixproc1 stores parmdatalth&parmworkdata in working-storage
       * - converter inserts 'MOVE's to linkage section
       *note1 - may need to modify, since only 1st parm-data field moved
       *note2 - option m1 on uvcopy cnvmf5 to insert unixwork1/unixproc1
        program-id. car120.
 uvM   * converted by cnvMF5 uvcopy 20160415 on 2016/08/17_11:07:53
        environment division.
        input-output section.
        file-control.
 uvM        select custmas assign external CUSTMAS
            organization record sequential access mode sequential.
 uvM        select nalist assign external NALIST
 uvM               organization line sequential.
        data  division.
        file section.
        fd  custmas record contains 256 characters.
        01  cm1. copy "custmas.cpy".
        fd  nalist record contains 90 characters.
        01  listrec.
               05 list-cust      pic 9(6).
               05 list-delete    pic x(4).
               05 list-nameadrs  pic x(80).
        working-storage section.
 uvM    copy "unixwork1.cpy".
        01  page-hdngs.
            05 filler            pic x(40) value
               'CAR120: CUSTOMER NAME & ADDRESS LIST    '.
            05 report-date       pic x(20) value spaces.
            05 filler            pic x(60) value spaces.
        01  cm1-eof              pic x value ' '.
       *
        linkage section.
 uvM    01 parmlinkdata        pic  x(200).
        01  parm-data-pkt.
            05 parm-lth          pic 9(4) comp.
            05 parm-data         pic x(100).
       *
        procedure division using parm-data-pkt.
 uvM        perform unixproc1.
 uvP               move parmdatalth to parm-lth.
 uvP               move parmworkdata to parm-data.
       *note - cobol converter inserts 'PERFORM UNIXPROC1' here
       *       & inserts move parmdatalth/parmworkdata from w/s to l/s
        mainline.
            open input custmas. open output nalist.
            move parm-data to report-date.
            if report-date equal spaces
               accept report-date from console.
            write listrec from page-hdngs before advancing 2 lines.
            read custmas at end move '1' to cm1-eof.
            perform dtlrtn until cm1-eof = '1'.
            close custmas nalist.
            stop run.
        dtlrtn.
            move spaces to listrec.
            move cm-cust to list-cust.
            move cm-delete to list-delete.
            move cm-nameadrs to list-nameadrs.
            write listrec before advancing 1 line.
            read custmas at end move '1' to cm1-eof.
 uvM    copy "unixproc1.cpy".

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

3C4. COBOL conversion Problems & Solutions

Op. Instrns. demo car120.cbl PARM=... data

We will follow the test procedures documented at JCLcnv1demo.htm#4F0. Those documents setup mvstest user & copy the test/demo JCLs/programs from /home/uvadm/mvstest/* to /home/mvstest/...

Refer to page JCLcnv1demo.htm#4B2 & 4B3 to see the various subdirs referred to in the Op. Instrns below (jcls, cbls, etc).

We will assume that the JCL has already been converted as shown on page JCLcnv1demo.htm#3F1.

The COBOL program conversions have already been documented on page '2C1' of this document (MVSCOBOL.doc) - for all programs or for 1 at a time.

We will show here the reconvert, compile & execution followed by the sample report that should be created.


 #0. login mvstest  --> /home/mvstest

 #1. cnvMF51 cbl0/CAR120.cbl   <-- convert 1 program cbl0->cbl1->cbl2
     =======================     - prompts to copy to cbls & compile
                                 - OR do manually as shown below

 #2. cp cbl2/car120.cbl cbls   <-- copy converted prgm to cbls
     =======================

 #3. mfcbl1 car120.cbl    <-- compile program
     =================

 #4. jar120.ksh           <-- execute JCL to execute car120.cbl
     ==========

 #5. cd testdata          <-- change into testdata subdir
     ===========

 #6. l ar                 <-- list files in the A/R subdir
     ====

 #7. vi data1/ar.customer.nameadrs.list120  <-- inspect the output report
     =====================================    - note date in page hdng from PARM=...

sample report created by car120.cbl

 CUSTOMER NAME & ADDRESS LIST       MARCH 12, 2005
 130140    EVERGREEN MOTORS LTD.    1815 BOWEN ROAD          NANAIMO          BC V9S1H1
 132588    GEECOE GENERATOR SERVICESUNIT 170 - 2851 SIMPSON  RICHMOND         BC V6X2R2
 139923    JOHNSTONE BOILER & TANKS 1250 EAST PENDER STREET  VANCOUVER        BC V5L1W1

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

3D1. COBOL conversion Problems & Solutions

PARM-DATA Alternate Solution

The previous page presented an all COBOL solution (for the retrieval of 'PARM' data from JCL to COBOL program) by using the Micro Focus COBOL display/accept environment-name/environment-variable mechanism. We will now present an alternative solution using a C subroutine.

The following pages will list the 'C' subrtn, a demo COBOL program,& the operating instructions to compile & run the test/demo.

Note
  • it is better to link C subrtns with COBOL run-time (rts32), because:
  • linking subrtn with rts32 makes it available to all .int programs
  • otherwise you have to compile & link C subrtn with all programs needing
  • you can still use animation (which does not work with linked cobols)
  • .int's are very small but linked COBOL programs are very large

3D1. Operating instructions to compile & link the C subrtn with the Micro
Focus COBOL runtime 'rts32' (invoked by 'cobrun' in converted scripts).

3D2. 'getparm' C subroutine to get the value of the 'export'ed PARM variable
& store both the data & its length into the COBOL program.

3D3. 'car130.cbl' COBOL program to test/demo this procedure

3D4. Operating Instructions to run the demo (under mvstest or vsetest)

Op. Instrns. to compile/link getparm with rts32


 #1. su root             <-- switch to root user

 #2. cd $COBDIR/bin      <-- change to Micro Focus COBOL bin directory

 #3. mv rts32 rts32.old                              <-- save old rts32

 #4. cob -xvo rts32 /home/uvadm/srcf/getparm.c -e ""  <-- compile/link rts32
     ===============================================
Note
  • you can regen rts32 to remove any subrtns as follows:

 #5. cob -xvo rts32 -e ""      <-- regen rts32 without subrtns
     ====================

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

3D2. getparm.c - C subrtn to get PARM value for COBOL

 /* getparm.c - get PARM-DATA via environmental variable 'PARM'              */
 /*           - by Owen Townsend, UV Software, March 2005                    */
 /* This C subrtn can be used for mainframe conversions to unix/linux        */
 /* - to transfer data from JCL PARM=... to the COBOL program                */
 /* - see sample calling program CAR130 at www.uvsoftware.ca/mvscobol.htm#3D2*/
 /* - relevant lines in the JCL & COBOL program would be:                    */
 /*                                                                          */
 /*   // EXEC CAR130,PARM=xxxxxxxxxxxxxx   <-- JCL calls COBOL w PARM=...    */
 /*   WORKING-STORAGE SECTION.             <-- see getparm2.c LINKAGE SECTION*/
 /*   01 PARM-LTH    PIC  9(4).            <-- subrtn stores data length     */
 /*   01 PARM-DATA   PIC  X(100).          <-- subrtn stores data blank fill */
 /*   CALL "getparm" USING PARM-LTH PARM-DATA.                               */
 /*                                                                          */
 /*Note - difference getparm.c vs getparm2.c                                 */
 /* - this getparm.c for WORKING-STORAGE parm-lth 4 bytes numeric            */
 /* - vs getparm2.c for parm-data in LINKAGE SECTION, parm-lth 2 bytes binary*/
 /* - problem on Intel Little-End vs Big-End used by mainframe & Micro Focus */
 /*                                                                          */
 /* Compile & link this subrtn with the Micro Focus runtime 'rts32'          */
 /*  1. su root             <-- switch to root user                          */
 /*  2. cd $COBDIR/bin      <-- change to Micro Focus COBOL bin directory    */
 /*  3. mv rts32 rts32.old                             <-- save old rts32    */
 /*  4. cob -xo rts32 /home/uvadm/srcf/getparm.c -e "" <-- compile/link rts32*/
 /*     ==============================================                       */

#include <string.h> #include <stdlib.h> #include <sys/types.h>

 int getparm(char *parmlth, char *parmdata)
 {
 char *pdp;                   /* ptr to parmdata from getenv("PARM")    */
 char parmdata1[256];         /* parmdata retrieved via PARM env-var    */
 char parmdata2[256];         /* copied here or blanks copied to caller */
 char parmlth2[8];            /* parmlth copied to caller or "0000"     */
 int parmlth1;                /* binary length of parmdata1             */

/* init data areas to be copied to calling program (in case PARM undef)*/ memset(parmdata2,' ',100); memset(parmdata2+100,'\0',156); strcpy(parmlth2,"0000");

 /* get parmdata into local storage via PARM env-var */
 pdp = getenv("PARM");
 if (pdp)
   { strcpy(parmdata1,pdp);                /* copy parmdata to local w/s    */
     parmlth1 = strlen(parmdata1);         /* capture parmdata string length*/
     memcpy(parmdata2,parmdata1,parmlth1); /* copy for blank fill vs null   */
     sprintf(parmlth2,"%04d",parmlth1);    /* convert int lth to numerics   */
   }

/* copy parmdata & length to calling program (or blanks & zeros) */ memcpy(parmdata,parmdata2,100); memcpy(parmlth,parmlth2,4); return(0); }

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

3D3. COBOL demo program 'car130.cbl' for getparm.c

        identification division.
       * car130 - test mainframe conversion to micro focus cobol
       * - capture parm-data from jcl // exec program,parm=xxx
       * this car130.cbl illustrates using a c subrtn
       * with --> call "GETPARM" using parm-data parm-lth
       * vs car120.cbl all cobol solution, vu converter inserts code
       * - display "PARM" upon env-var & accept parm-data from env-var
        program-id. car130.
        environment division.
        input-output section.
        file-control.
 uvM   * select custmas assign custmas
 uvM        select custmas assign external custmas
                   organization record sequential access mode sequential.
 uvM   * select nalist assign nalist
 uvM        select nalist assign external nalist
 uvM               organization line sequential.
        data  division.
        file section.
        fd  custmas record contains 256 characters.
            01 cm1. copy "custmas.cpy".
        fd  nalist record contains 90 characters.
            01 listrec.
               05 list-cust      pic 9(6).
               05 list-delete    pic x(4).
               05 list-nameadrs  pic x(80).
       *
        working-storage section.
 uvM    copy "unixwork1.cpy".
        01  page-hdngs.
            05 filler            pic x(35) value
               'CUSTOMER NAME & ADDRESS LIST      '.
            05 report-date       pic x(20) value spaces.
            05 filler            pic x(5) value 'PAGE#'.
            05 filler            pic x(60) value spaces.
        01  cm1-eof              pic x value ' '.
       *
       * parameters for: call "GETPARM" using parm-lth parm-data.
       * - getparm.c uses w-s vs l-s & noneed for using on proc div
       * - note parm-lth is numeric, not binary (avoid big/little end)
        01 parm-lth          pic 9(4) value zeros.
        01 parm-data         pic x(100) value spaces.
       *
        procedure division.
 uvM        perform unixproc1.
        mainline.
            open input custmas. open output nalist.
            call "getparm" using parm-lth parm-data.
            move parm-data to report-date.
            write listrec from page-hdngs before advancing 2 lines.
            read custmas at end move '1' to cm1-eof.
            perform dtlrtn until cm1-eof = '1'.
            close custmas nalist.
            stop run.

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

        dtlrtn.
            move spaces to listrec.
            move cm-cust to list-cust.
            move cm-delete to list-delete.
            move cm-nameadrs to list-nameadrs.
            write listrec before advancing 1 line.
            read custmas at end move '1' to cm1-eof.
 uvM    copy "unixproc1.cpy".

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

3D4. COBOL conversion Problems & Solutions

Op. Instrns. to demo car130.cbl & getparm.c

We will follow the test procedures documented aat MVSJCL.htm#1J1. Those documents setup mvstest user & copy the test/demo JCLs/programs from /home/uvadm/mvstest/* to /home/mvstest/...

Refer to page JCLcnv1demo.htm#3B2 & 3B3 to see the various subdirs referred to in the Op. Instrns below (jcls, cbls, etc).

We will assume that the JCL has already been converted as shown on page JCLcnv1demo.htm#3F1.

The COBOL program conversions have already been documented on page '2C1' of this document (MVSCOBOL.doc) - for all programs or for 1 at a time.

We will show here the reconvert, compile & execution followed by the sample report that should be created.


 #0. login mvstest  --> /home/mvstest

 #1. cnvMF51 cbl0/CAR130.cbl   <-- convert 1 program cbl0->cbl1->cbl2
     =======================     - prompts to copy to cbls & compile
                                 - OR do manually as shown below

 #2. cp cbl2/car130.cbl cbls   <-- copy converted prgm to cbls
     =======================

 #3. mfcbl1 car130.cbl    <-- compile program
     =================

 #4. jar130.ksh           <-- execute JCL to execute car130.cbl
     ==========

 #5. cd testdata          <-- change into testdata subdir
     ===========

 #6. l ar                 <-- list files in the A/R subdir
     ====

 #7. vi data1/ar.customer.nameadrs.list130  <-- inspect the output report
     =====================================    - note date in page hdng from PARM=...

sample report created by car130.cbl

 CUSTOMER NAME & ADDRESS LIST       MARCH 11, 2005      PAGE#
 130140    EVERGREEN MOTORS LTD.    1815 BOWEN ROAD          NANAIMO          BC V9S1H1
 132588    GEECOE GENERATOR SERVICESUNIT 170 - 2851 SIMPSON  RICHMOND         BC V6X2R2
 139923    JOHNSTONE BOILER & TANKS 1250 EAST PENDER STREET  VANCOUVER        BC V5L1W1

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

3E1. COBOL conversion Problems & Solutions

C subrtn to replace COBOL LS & PD USING PARM-DATA

 /* getparm2.c - get PARM-DATA via environmental variable 'PARM'           */
 /*            - by Owen Townsend, UV Software, March 2005                 */
 /*                                                                        */
 /* C subrtn to replace 'PROCEDURE DIVISION USING PARM-DATA-FROM-EXEC'     */
 /* - to transfer data from JCL EXEC program,PARM=... to the COBOL program */
 /* - Mainframe COBOL program defined L/S & P/D as follows:                */
 /*   LINKAGE SECTION.                                                     */
 /*   01 PARM-LTH    PIC  9(4) COMP.                <--Note 2 bytes binary */
 /*   01 PARM-DATA   PIC  X(100).                                          */
 /*   PROCEDURE DIVISION USING PARM-DATA-FROM-JCL.                         */
 /*                                                                        */
 /*Note - difference getparm2.c vs getparm.c                               */
 /* - this getparm2.c for mainframe COBOL with parm-data in LINKAGE SECTION*/
 /*   and parm-lth 2 bytes binary (problem on Intel Little-End vs Big-End) */
 /* - vs getparm.c for WORKING-STORAGE parm-lth 4 bytes numeric            */
 /*                                                                        */
 /*  Compile & link this subrtn with the Micro Focus runtime 'rts32'       */
 /*  1a. su root             <-- switch to root user                       */
 /*  1b. cd $COBDIR/bin      <-- change to Micro Focus COBOL bin directory */
 /*  1c. mv rts32 rts32.old                             <-- save old rts32 */
 /*  1d. cob -xo rts32 /home/uvadm/srcf/getparm2.c -e "" <-- cmpl/link rts32*/
 /*      ===============================================                   */

#include <string.h> #include <stdlib.h> #include <sys/types.h>

 void getparm2(short *parmlth, char *parmdata)
 {
 char *pdp;                   /* ptr to parmdata from getenv("PARM")    */
 char parmdata1[256];         /* parmdata retrieved via PARM env-var    */
 char parmdata2[256];         /* copied here or blanks copied to caller */
 int parmlth1;                /* binary length of parmdata1             */

/* init data areas to be copied to calling program (in case PARM undef)*/ memset(parmdata2,' ',100); memset(parmdata2+100,'\0',156);

 /* get parmdata into local storage via PARM env-var */
 pdp = getenv("PARM");
 if (pdp)
   { strcpy(parmdata1,pdp);                /* copy parmdata to local w/s    */
     parmlth1 = strlen(parmdata1);         /* capture parmdata string length*/
     memcpy(parmdata2,parmdata1,parmlth1); /* copy for blank fill vs null   */
   }
 /* copy parm-length & parm-data to calling program */
 *parmlth = parmlth1;
 memcpy(parmdata,parmdata2,100);
 return;
 }

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

3E2. COBOL conversion Problems & Solutions

COBOL program to demo getparm2 C subrtn

        identification division.
       * car135 - test mainframe conversion to micro focus cobol
       * - capture parm-data from jcl // exec program,parm=xxxxx
       * this car135.cbl illustrates using a c subrtn with
       * - call "getparm2" using parm-length parm-data
       * - linkage section with 2 byte binary length & 100 byte data
        program-id. car135.
        environment division.
        input-output section.
        file-control.
            select custmas assign custmas
                   organization sequential access mode sequential.
            select nalist assign nalist
                   organization line sequential.
        data  division.
        file section.
        fd  custmas record contains 256 characters.
            01 cm1. copy "custmas.cpy".
        fd  nalist record contains 120 characters.
            01 listrec.
               05 list-cust      pic 9(6).
               05 list-delete    pic x(4).
               05 list-nameadrs  pic x(80).
        working-storage section.
        01  page-hdngs.
            05 filler            pic x(35) value
               'CUSTOMER NAME & ADDRESS LIST      '.
            05 report-date       pic x(20) value spaces.
            05 filler            pic x(5) value 'PAGE#'.
            05 filler            pic x(60) value spaces.
        01  cm1-eof              pic x value ' '.
       * parameters for: call "getparm2" using parm-data-from-exec.
        linkage section.
        01  parm-data-from-exec.
            05  parm-length                 pic s9(04) comp.
            05  parm-data                   pic x(100).
        procedure division using parm-data-from-exec.
        mainline.
       *note - following 'CALL GETPARM' will be inserted in conversion
       * - to replace mainframe auto handling of parm-data-from-exec
       *    call "getparm2" using parm-lth parm-data.
            move parm-data to report-date.
            open input custmas. open output nalist.
            write listrec from page-hdngs before advancing 2 lines.
            read custmas at end move '1' to cm1-eof.
            perform dtlrtn until cm1-eof = '1'.
            close custmas nalist. stop run.
        dtlrtn.
            move spaces to listrec.
            move cm-cust to list-cust.
            move cm-delete to list-delete.
            move cm-nameadrs to list-nameadrs.
            write listrec before advancing 1 line.
            read custmas at end move '1' to cm1-eof.

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

3F1. COBOL conversion Problems & Solutions

Executing fully Linked programs vs .int's

I do NOT recommend executing Linked COBOL programs. It is prefereable to execute the '.int' programs because you can animate them at any time, and there is usually no serious performance hit.

You might want to compile & link to executable binaries for 2 reasons:

  1. Large prgrams with a lot of table indexing may run faster

  2. You want to link in C subroutines

Note that the previous topic '3D1' showed an alternative method of using C subrtns that did not require linking them with your COBOL programs. The alternative was to link the C subrtns with 'rts32' (the COBOL runtime). This is advantageous because you can still animate the programs. Another advantage is that you only have to link a C subrtn once with rts32 & you can subsequently use that C subrtn with any or all future COBOL programs.

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

3F2. COBOL conversion Problems & Solutions

Compiling & running fully Linked programs

We will illustrate this using car140.cbl, getparm.c,& jar140.jcl. The COBOL program, C subroutine,& the JCL are the same (except for the name changes & some *comments) as in the previous example.

The previous example linked the C subrtn with the Micro Focus COBOL runtime rts32/cobrun, But this example will link the C subrtn directly with the user's application COBOL program.

Vancouver Utilities provides an alternative compile script 'mfcbl1x' (vs 'mfcbl1') to compile & link a COBOL program with a C subrtn.


 #0. login mvstest    --> /home/mvstest/
     =============        relevant subdirs-->jcls, cbls, Csub, cblx

 #1. mfcbl1x car140.cbl getparm.c  <-- compile & link program with C subrtn
     ============================

 #2. ls -l cblx             <-- observe fully linked 'car140' (no extension)
     ==========

 #3. vi jcls/jar140.ksh
     ==================
     - modify the COBOL program execution (line #44)
       from --> cobrun $ANIM $CBLX/car140
         to --> $CBLX/car140               <-- to execute binary vs .int

 #4. jar140.ksh   <-- execute the JCL/script & COBOL binary program car140
     ==========

 #5. ls -l ar     <-- observe report output created
     ========

Note that in #3 above, we manually changed 'cobrun $ANIM $CBLX/car140' to just '$CBLX/car140' to execute the fully linked program (car140 no extension) vs using cobrun to interpret car140.int.

The JCL converter has an option to generate the command for linked programs, but 'cobrun'ing the .int's is preferable for most programs, so we can manually change the few exceptions.

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

3F3. COBOL conversion Problems & Solutions

modified jcls/jar140.ksh (relevant lines only)

 k#013 # * CUSTOMER N&A LIST WITH DATE FROM GETPARM.C LINKED WITH COBOL CAR140
 k#014 # * - AFTER CONVERT, CHANGE 'COBRUN $ANIM $DX/CAR140' TO '$DX/CAR140'
 k#015 # * - VS JAR130/CAR130 USING GETPARM.C LINKED WITH RTS32(COBRUN)
 k#016 #1======================= begin step#S0010 CAR140 ========================
 k#017 S0010=A
 k#018 stepctl51;
 k#019 goto
 k#020 export JSTEP=S0010; ((XSTEP+=1)); SCC=0; LCC=0; alias goto="";
 k#021 logmsg2 "******** Begin Step $JSTEP car140 (#$XSTEP) ********"
 k#022 ##STEP010  EXEC PGM=CAR140,PARM='JULY 30, 2006'
 k#023 export PROGID=car140
 k#024 export PARM="JULY 30, 2006"
 k#025 exportfile  CUSTMAS data1/ar.customer.master
 k#026 exportfile  NALIST data1/ar.customer.nameadrs.list130
 k#027 exportfile SYSOUT $SYOT/${jobid2}_${JSTEP}_SYSOUT_$(date +%y%m%d_%H%M%S)
 k#028 exportfile SYSIN $JTMP/${JSTEP}_${PROGID}_SYSIN
 k#029 cat > $SYSIN <</*
 k#030 FISCALYEAR=2004
 k#031 /*
 k#032 logmsg2 "Executing--> cobrun $ANIM $CBLX/car140"
 k#033 #3----------------------------------------------------------------------
 k#034 ## cobrun $ANIM $CBLX/car140   <-- disabled                          <-- NOTE
       $CBLX/car140                   <-- execute linked program (vs .int)  <-- NOTE
 k#035 #4----------------------------------------------------------------------

console log of jar140.ksh execution

 151026:164655:jar140: Begin Job=jar140
 151026:164655:jar140: /home/mvstest/testlibs/jcls/jar140.ksh
 151026:164655:jar140: Arguments: jar140.ksh
 151026:164655:jar140: ProcessID=8701
 151026:164655:jar140: RUNDATE=20151026
 151026:164655:jar140: RUNLIBS=/home/mvstest/testlibs
 151026:164655:jar140: RUNDATA=/home/mvstest/testdata
 151026:164655:jar140: JTMP=jobtmp/jar140
 151026:164655:jar140: SYOT=sysout/JAR140
 151026:164655:jar140: LOGNAME=mvstest TESTPROD=T000
 151026:164655:jar140: HOSTNAME=uvsoft5.uvsoftware.ca
 151026:164655:jar140: ******** Begin Step S0010 car140 (#1) ********
 151026:164655:jar140: file: CUSTMAS=data1/ar.customer.master fsize=8K
 151026:164655:jar140: file: NALIST=data1/ar.customer.nameadrs.list130 fsize=4K
 151026:164655:jar140: file: SYSOUT=sysout/JAR140/jar140_S0010_SYSOUT_151026_164655 fsize=0K
 151026:164655:jar140: file: SYSIN=jobtmp/jar140/S0010_car140_SYSIN fsize=0K
 151026:164655:jar140: Executing--> $CBLX/car140
 151026:164656:JAR140: StepTimes: S0010 car140 Begun=16:46:55 End=16:46:56 Elapsed=00:00:01
 151026:164656:JAR140: Job Times: Begun=16:46:55 NormalEnd=16:46:56 Elapsed=00:00:01
 151026:164656:jar140: JobEnd=Normal, JCC=0, StepsExecuted=1, LastStep=S0010

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

3G1. COBOL conversion Problems & Solutions

compile/link with archive of called programs

I do NOT recommend executing Linked COBOL programs. It is preferable to execute the '.int' programs because you can animate them at any time, and there is usually no serious performance hit.

You might want to compile & link with archive of called programs because:

  1. Large prgrams with a lot of table indexing may run faster

  2. You want to link in called programs (COBOL & C) vs prior method ('3D1') of linking C subrtns with rts32 (cobrun)

  3. You need to allow multiple 'called' programs (COBOL &/or C) vs prior method ('3F1') of compile link 1 COBOL with 1 C subrtn.

Note that the previous topic '3D1' showed an alternative method of using C subrtns that did not require linking them with your COBOL programs. The alternative was to link the C subrtns with 'rts32' (the COBOL runtime). This is advantageous because you can still animate the programs.

We will illustrate this using:

  1. getdate.cbl - COBOL called program, compiled & archived into lib/called.a with script 'mfcbl1o'

  2. car115.cbl - COBOL calling program, compiled with script 'mfcbl1y' - fully linked to an executable (no .extension vs .int)

  3. jar115.jcl - JCL/script executing car115 (which calls getdate)

The previous example '3F1' allowed only 1 called program. This method allows multiple called programs, but they must have been previouly compiled, archived, & copied to 'lib/called.a'.

Vancouver Utilities provides alternative compile script 'mfcbl1y' (vs 'mfcbl1' or 'mfcbl1x'). We will first create lib/called.a with called program: getdate.cbl (in subdir Csub/...).

We assume that the mainframe programs have already been covnerted for Micro Focus COBOL & are in subdir cbls/... We assume the mainframe JCL has been converted to script & copied to jcls/... (in the search PATH)

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

3G2. COBOL conversion Problems & Solutions

compile/link with archive of called programs


 #0a. login vsetest    --> /home/vsetest/
      =============        relevant subdirs--> cbls, lib, cblx,& jcls.

 #0b. cdl  alias cd='cd $RUNLIBS' --> /home/vsetest/testlibs
      ===

 #1. mkdir lib       <-- make subdir to receive archive 'called.a'
     =========

 #2. mfcbl1o getdate.cbl called.a
     ============================
     - compile cbls/getdate.cbl to .o object & archive to lib/called.a

 #2a. ar -tv lib/called.a  <-- list objects in archive
      ===================

 #3. mfcbl1y car115.cbl   <-- compile & link program with C subrtn
     ==================

 #3a. ls -l cblx          <-- observe fully linked 'car115' (no extension)
      ==========

 #4. vi jcls/jar115.ksh
     ==================
     - modify the COBOL program execution (line #44)
       from --> cobrun $ANIM $CBLX/car115
         to --> $CBLX/car115               <-- to execute binary vs .int

 #5. jar115.ksh   <-- execute the JCL/script & COBOL binary program car115
     ==========

 #6. cdd  alias cd='cd $RUNDATA' --> /home/vsetest/testdata
     ===

 #7. ls -l data     <-- observe report output created
     ==========         (data1/ar.customer.nameadrs.list115)

Note that in #3 above, we manually changed 'cobrun $ANIM $CBLX/car115' to just '$CBLX/car115' to execute the fully linked program (car115 no extension) vs using cobrun to interpret car115.int.

The JCL converter has option 'r2' to generate the command for linked programs, but 'cobrun'ing the .int's is preferable for most programs, so we can manually change the few exceptions.

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

3G3. COBOL conversion Problems & Solutions

called sub-program getdate.cbl

        identification division.
        program-id. getdate.
        author.     uvsoftware.
       ****************************************************************
       * getdate - cobol called program to get current date
       * accepts 6 digit yymmdd from unix os,& prepends century '20'
       * - could easily do in calling cobol program
       * - this used to demo replacing assembler subrtn with cobol
       ****************************************************************
        environment division.
        input-output section.
        data division.
       *working-storage section.
       *01 dummy1                   pic x(80).
 uvM    working-storage section.
 uvM    copy "unixwork1.cpy".
        linkage section.
        01  sysdate.
            05  sysdate-cc          pic 9(02).
            05  sysdate-yymmdd.
                10  sysdate-yy      pic 9(02).
                10  sysdate-mm      pic 9(02).
                10  sysdate-dd      pic 9(02).
       *
        procedure division using sysdate.
 uvM        perform unixproc1.
        mainpara.
            accept sysdate-yymmdd from date.
            move '20' to sysdate-cc.
            goback returning 00.
       *
 uvM      copy "unixproc1.cpy".

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

3G4. COBOL conversion Problems & Solutions

calling program car115.cbl

        identification division.
       * car115 - test/demo mainframe conversion to micro focus cobol
       * - customer n&a list with report hdng & date via accept env-var
       * - demo calling cobol sub-program (getdate.cbl)
       * - could accept date in cobol, but this demos mfcbl1o & mfcbl1x
       * - might need to replace called assemblers with cobol
       * - see www.uvsoftware.ca/vsecobol.htm#3g1
        program-id. car115.
        environment division.
        input-output section.
        file-control.
 uvM        select custmas assign external custmas
                   organization record sequential access mode sequential.
 uvM        select nalist assign external nalist
 uvM               organization line sequential.
        data  division.
        file section.
        fd  custmas record contains 256 characters.
 uvM****    01 cm1.
               copy "custmas.cpy".
        fd  nalist record contains 120 characters.
            01 listrec.
               05 list-cust       pic 9(6).
               05 list-delete     pic x(4).
               05 list-nameadrs   pic x(80).
        working-storage section.
 uvM    copy "unixwork1.cpy".
        01  page-hdngs.
            05 filler            pic x(40) value
               'CAR110: CUSTOMER NAME & ADDRESS LIST'.
            05 system-date       pic x(8) value spaces.
            05 filler            pic x(72) value spaces.
        01  cm1-eof              pic x value ' '.
       *
        procedure division.
 uvM        perform unixproc1.
        mainline.
            call "getdate" using system-date.
            open input custmas. open output nalist.
            write listrec from page-hdngs before advancing 2 lines.
            read custmas at end move '1' to cm1-eof.
            perform dtlrtn until cm1-eof = '1'.
            close custmas nalist.
            stop run returning 00.
        dtlrtn.
            move spaces to listrec.
            move cm-cust to list-cust.
            move cm-delete to list-delete.
            move cm-nameadrs to list-nameadrs.
            write listrec before advancing 1 line.
            read custmas at end move '1' to cm1-eof.
 uvM      copy "unixproc1.cpy".

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

3G5. COBOL conversion Problems & Solutions

JCL/script jar115.ksh

 k#001 #!/bin/ksh
 k#002 ##JAR150   JOB  (1234),'TEST MVS JCL CONVERT ACCEPT FROM CONSOLE'
 k#003 export jobid2=jar150 JOBID2=JAR150; scriptpath="$0"; args="$*"
 k#004 if [[ -z "$jobid1" ]]; then export jobid1=$jobid2; fi
 k#005 for arg in $args; do if [[ "$arg" == *=* ]]; then export $arg; fi; done
 k#006 integer JCC=0 SCC=0 LCC=0  # init step status return codes
 k#007 autoload jobset51 jobend51 jobabend51 logmsg1 logmsg2 stepctl51
 k#008 autoload exportfile exportgen0 exportgen1 exportgen2 exportgenall exportgenx
 k#009 . $APPSADM/env/stub.ini  #<-- for control-M (see notes in env/stub.ini)
 k#010 jobset51    # call function for JCL/script initialization
 k#011 goto
 k#012 S0000=A
 k#013 # * CUSTOMER N & A LISTING - WITH DATE FROM ACCEPT CONSOLE
 k#014 # * USE TO TEST FILE I/O LOCKING WHEN 1 JOB WAITING FOR ACCEPT ENTRY
 k#015 # * WHILE THIS JAR150 WAITING, RUN JAR155 & OBSERVE LOCK ERROR
 k#016 #1======================= begin step#S0010 CAR150 ========================
 k#017 S0010=A
 k#018 stepctl51;
 k#019 goto
 k#020 export JSTEP=S0010; ((XSTEP+=1)); SCC=0; LCC=0; alias goto="";
 k#021 logmsg2 "******** Begin Step $JSTEP car150 (#$XSTEP) ********"
 k#022 ##STEP010  EXEC PGM=CAR150
 k#023 export PROGID=car150
 k#024 export PARM=""
 k#025 exportfile  CUSTMAS data1/ar.customer.master
 k#026 exportfile  NALIST data1/ar.customer.nameadrs.list150
 k#027 exportfile SYSOUT $SYOT/${jobid2}_${JSTEP}_SYSOUT_$(date +%y%m%d_%H%M%S)
 k#028 exportfile SYSIN $JTMP/${JSTEP}_${PROGID}_SYSIN
 k#029 cat > $SYSIN <</*
 k#030 FISCALYEAR=2004
 k#031 /*
 k#032 logmsg2 "Executing--> cobrun $ANIM $CBLX/car150"
 k#033 #3----------------------------------------------------------------------
 k#034 cobrun $ANIM $CBLX/car150
 k#035 #4----------------------------------------------------------------------
 k#036 LCC=$?; S0010C=$LCC; ((SCC|=LCC)); ((JCC|=LCC)); S0010R=1; alias goto="";
 k#037 if ((S0010C != 0))
 k#038    then logmsg2 "ERR: step#$JSTEP car150 abterm $SCC"
 k#039    alias goto="<<S9900=\A"; fi
 k#040 goto
 k#041 #8======================================================================
 k#042 S9000=A
 k#043 jobend51 #move any new GDG files from jobtmp to intended outdirs
 k#044 logmsg2 "JobEnd=Normal, JCC=$JCC, StepsExecuted=$XSTEP, LastStep=$JSTEP"
 k#045 exit 0 #ver:20151023 a2b0c0d1e2f0g1h1i15j0k15l1m4n3o8p0q0r0s2t1u1v0w0x0y1z1
 k#046 #9======================================================================
 k#047 S9900=A
 k#048 jobabend51 #report GDGs NOT moved from jobtmp/subdirs to outdirs
 k#049 logmsg2 "JobEnd=AbTerm, JCC=$JCC,Steps=$XSTEP/$JSTEP" RV ACK
 k#050 exit $JCC

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

3G6. COBOL conversion Problems & Solutions

console log of jar115.ksh execution

 151026:123817:jar115: Begin Job=jar115
 151026:123817:jar115: /home/mvstest/testlibs/jcls/jar115.ksh
 151026:123817:jar115: Arguments: jar115.ksh
 151026:123817:jar115: ProcessID=17865
 151026:123817:jar115: RUNDATE=20151026
 151026:123817:jar115: RUNLIBS=/home/mvstest/testlibs
 151026:123817:jar115: RUNDATA=/home/mvstest/testdata
 151026:123817:jar115: JTMP=jobtmp/jar115
 151026:123817:jar115: SYOT=sysout/JAR115
 151026:123817:jar115: LOGNAME=mvstest TESTPROD=T000
 151026:123817:jar115: HOSTNAME=uvsoft5.uvsoftware.ca
 151026:123817:jar115: ******** Begin Step S0010 car115 (#1) ********
 151026:123817:jar115: file: CUSTMAS=data1/ar.customer.master fsize=8K
 151026:123817:jar115: file: NALIST=data1/ar.customer.nameadrs.list115 fsize=4K
 151026:123817:jar115: file: SYSOUT=sysout/JAR115/jar115_S0010_SYSOUT_151026_123817 fsize=0K
 151026:123817:jar115: Executing--> cobrun -F /home/mvstest/testlibs/cblx/car115
 151026:123817:JAR115: StepTimes: S0010 car115 Begun=12:38:17 End=12:38:17 Elapsed=00:00:00
 151026:123817:JAR115: Job Times: Begun=12:38:17 NormalEnd=12:38:17 Elapsed=00:00:00
 151026:123817:jar115: JobEnd=Normal, JCC=0, StepsExecuted=1, LastStep=S0010

output report customer.nameadrs.list115

CAR110: CUSTOMER NAME & ADDRESS LIST 20100331

 130140    EVERGREEN MOTORS LTD.    1815 BOWEN ROAD          NANAIMO          BC V9S1H1
 132588    GEECOE GENERATOR SERVICESUNIT 170 - 2851 SIMPSON  RICHMOND         BC V6X2R2
 139923    JOHNSTONE BOILER & TANKS 1250 EAST PENDER STREET  VANCOUVER        BC V5L1W1
              -------------- 28 lines omitted -----------------
 406082    PRECAM RENTALS LTD:      10116-94TH AVE           FORT ST. JOHN    BC V1G5G6

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

3H1. COBOL conversion Problems & Solutions

Test File Locking for MF COBOL

Micro Focus COBOL provides for file & record locking via the 'LOCK MODE IS ...' clause on the SELECT statement. Here are a few possibilities:

  1. 'LOCK MODE' omitted - defaults to EXCLUSIVE, except for 'OPEN INPUT'.

  2. 'LOCK MODE IS EXCLUSIVE' - entire file will be locked on OPEN.

  3. 'LOCK MODE IS AUTOMATIC WITH LOCK ON RECORD' - record lock acquired by 'READ' - released on any subsequent I/O on this file, except for START.

Here we will test only the default (EXCLUSIVE except for OPEN INPUT). We will use the following COBOL program & JCLs:

  1. car150.cbl - program to read a file (CUSTMAS) & write a report (NALIST). - CUSTMAS & NALIST are the logical names - the JCL defines the physical names - this program solicits console input from the operator - the prompt/pause allows us to run the 2nd JCL to test the locks - note that the files are opened before the prompt - see program listing on page '3H3'

  2. jar150.jcl - JCL to execute the car150.cbl COBOL program - defines input file (CUSTMAS) as data1/ar.customer.master - defines output file (NALIST) as data1/ar.customer.nameadrs.list150

  3. jar155.jcl - executes the same COBOL program & defines the same files

    jar150.jcl

 //JAR150   JOB  (1234),'TEST MVS JCL CONVERT ACCEPT FROM CONSOLE'
 //* CUSTOMER N & A LISTING - WITH DATE FROM ACCEPT CONSOLE
 //* USE TO TEST FILE I/O LOCKING WHEN 1 JOB WAITING FOR ACCEPT ENTRY
 //* WHILE THIS JAR150 WAITING, RUN JAR155 & OBSERVE LOCK ERROR
 //STEP010  EXEC PGM=CAR150
 //CUSTMAS  DD DSN=AR.CUSTOMER.MASTER,DISP=SHR
 //NALIST   DD DSN=AR.CUSTOMER.NAMEADRS.LIST150,DISP=(,CATLG,DELETE),
 //            UNIT=DISK,SPACE=(TRK,(25,25),RLSE),
 //            DCB=(MODEL.DSCB,LRECL=133,BLKSIZE=6118,RECFM=FBA)
 //SYSOUT   DD SYSOUT=*
 //SYSIN    DD *
 FISCALYEAR=2004
 /*

The 2nd job (JAR155) is the same as JAR150 except for the name & *comments. We will present the test/demo operating instructions on the next page, followed by listings of the COBOL program & the converted JCL/script.

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

3H2. COBOL conversion Problems & Solutions

Test File Locking for MF COBOL

The plan is to run jar150 & while is is waiting at the date entry prompt, we will run jar155 & observe the results.

To avoid confusion we will run the 2nd job under as 2nd login. Alternatively you could run jar150 in the background (jar150.ksh &). Then run jar155.ksh & observe results. Then you can bring jar150 back to the forground using the 'fg' command.


 #1. jar150.ksh                     <-- run jar150
     ==========
     ENTER REPORT DATE -->          <-- let jar150 wait at the prompt
 - - - on a 2nd login screen - - -

 #2. jar155.ksh                     <-- run jar155 (see results below)
     ==========

console output (from jar155)

 JAR155:050329:095210: JOB begun
 JAR155:050329:095210: RUNDATA=/home/mvstest/testdata RUNLIBS=/home/mvstest
 JAR155:050329:095210: DT=tape,DW=wrk,DP=rpts/050329
 JAR155:050329:095210: step# 1/1 car150 begun
 JAR155:050329:095210:  CUSTOMER NAME & ADDRESS LISTING WITH DATE FROM CONSOLE
 JAR155:050329:095210:  USE TO TEST FILE I/O LOCKING WHEN 1 JOB WAITING FOR ENTRY
 JAR155:050329:095210: file: CUSTMAS=data1/ar.customer.master
 JAR155:050329:095210: file: NALIST=data1/ar.customer.nameadrs.list150
 I/O error : file 'NALIST'
 error code: 9/065 (ANS74), pc=17F, call=1, seg=0
  65     File locked
 JAR155:050329:095210: step# 1 car150 abterm 255
 JAR155:050329:095210: JOB=JAR155 Terminated Abnormally

NOTES

  1. You can see the file lock error message is for the output file (NALIST), not for the input file (CUSTMAS) which was opened OK by both jobs.

  2. If desired you could change the physical filename in the 2nd jcl, (you might make it data1/ar.customer.nameadrs.listl155), and then observe that the 2 jobs will run together no problem.

  3. You could also modify the 'LOCK MODE' in the test programs & recompile to test other possibilities. However you would need to change the program to update the customer.master.indexed file to test the 'LOCK MODE IS AUTOMATIC WITH LOCK ON RECORD'.

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

3H3. COBOL program to test File Locking

        identification division.
       * car150 - test mainframe conversion to micro focus cobol
       *        - solicit report date from console operator
       * - used to test file i/o locking (when 1 job waiting)
        program-id. car150.
        environment division.
        input-output section.
        file-control.
            select custmas assign custmas
                   organization sequential access mode sequential.
            select nalist assign nalist
                   organization line sequential.
        data  division.
        file section.
        fd  custmas record contains 256 characters.
            01 cm1. copy "custmas.cpy".
        fd  nalist record contains 120 characters.
            01 listrec.
               05 list-cust      pic 9(6).
               05 list-delete    pic x(4).
               05 list-nameadrs  pic x(80).
        working-storage section.
        01  page-hdngs.
            05 filler            pic x(35) value
               'CUSTOMER NAME & ADDRESS LIST      '.
            05 report-date       pic x(20) value spaces.
            05 filler            pic x(65) value spaces.
        01  cm1-eof              pic x value ' '.
       * copybook saledtl inserted here for copybook crossref demos
        01 salerec. copy "saledtl.cpy".
       *
        procedure division.
        mainline.
            open input custmas. open output nalist.
            display "---> ENTER REPORT DATE ---> " upon console.
            accept report-date from console.
            write listrec from page-hdngs before advancing 2 lines.
            read custmas at end move '1' to cm1-eof.
            perform dtlrtn until cm1-eof = '1'.
            close custmas nalist.
            stop run.
        dtlrtn.
            move spaces to listrec.
            move cm-cust to list-cust.
            move cm-delete to list-delete.
            move cm-nameadrs to list-nameadrs.
            write listrec before advancing 1 line.
            read custmas at end move '1' to cm1-eof.

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

3H4. JCL/script to test File Locking

 k#001 #!/bin/ksh
 k#002 ##JAR150   JOB  (1234),'TEST MVS JCL CONVERT ACCEPT FROM CONSOLE'
 k#003 export jobid2=jar150 JOBID2=JAR150; scriptpath="$0"; args="$*"
 k#004 if [[ -z "$jobid1" ]]; then export jobid1=$jobid2; fi
 k#005 for arg in $args; do if [[ "$arg" == *=* ]]; then export $arg; fi; done
 k#006 integer JCC=0 SCC=0 LCC=0  # init step status return codes
 k#007 autoload jobset51 jobend51 jobabend51 logmsg1 logmsg2 stepctl51
 k#008 autoload exportfile exportgen0 exportgen1 exportgen2 exportgenall exportgenx
 k#009 . $APPSADM/env/stub.ini  #<-- for control-M (see notes in env/stub.ini)
 k#010 jobset51    # call function for JCL/script initialization
 k#011 goto
 k#012 S0000=A
 k#013 # * CUSTOMER N & A LISTING - WITH DATE FROM ACCEPT CONSOLE
 k#014 # * USE TO TEST FILE I/O LOCKING WHEN 1 JOB WAITING FOR ACCEPT ENTRY
 k#015 # * WHILE THIS JAR150 WAITING, RUN JAR155 & OBSERVE LOCK ERROR
 k#016 #1======================= begin step#S0010 CAR150 ========================
 k#017 S0010=A
 k#018 stepctl51;
 k#019 goto
 k#020 export JSTEP=S0010; ((XSTEP+=1)); SCC=0; LCC=0; alias goto="";
 k#021 logmsg2 "******** Begin Step $JSTEP car150 (#$XSTEP) ********"
 k#022 ##STEP010  EXEC PGM=CAR150
 k#023 export PROGID=car150
 k#024 export PARM=""
 k#025 exportfile  CUSTMAS data1/ar.customer.master
 k#026 exportfile  NALIST data1/ar.customer.nameadrs.list150
 k#027 exportfile SYSOUT $SYOT/${jobid2}_${JSTEP}_SYSOUT_$(date +%y%m%d_%H%M%S)
 k#028 exportfile SYSIN $JTMP/${JSTEP}_${PROGID}_SYSIN
 k#029 cat > $SYSIN <</*
 k#030 FISCALYEAR=2004
 k#031 /*
 k#032 logmsg2 "Executing--> cobrun $ANIM $CBLX/car150"
 k#033 #3----------------------------------------------------------------------
 k#034 cobrun $ANIM $CBLX/car150
 k#035 #4----------------------------------------------------------------------
 k#036 LCC=$?; S0010C=$LCC; ((SCC|=LCC)); ((JCC|=LCC)); S0010R=1; alias goto="";
 k#037 if ((S0010C != 0))
 k#038    then logmsg2 "ERR: step#$JSTEP car150 abterm $SCC"
 k#039    alias goto="<<S9900=\A"; fi
 k#040 goto
 k#041 #8======================================================================
 k#042 S9000=A
 k#043 jobend51 #move any new GDG files from jobtmp to intended outdirs
 k#044 logmsg2 "JobEnd=Normal, JCC=$JCC, StepsExecuted=$XSTEP, LastStep=$JSTEP"
 k#045 exit 0 #ver:20151023 a2b0c0d1e2f0g1h1i15j0k15l1m4n3o8p0q0r0s2t1u1v0w0x0y1z1
 k#046 #9======================================================================
 k#047 S9900=A
 k#048 jobabend51 #report GDGs NOT moved from jobtmp/subdirs to outdirs
 k#049 logmsg2 "JobEnd=AbTerm, JCC=$JCC,Steps=$XSTEP/$JSTEP" RV ACK
 k#050 exit $JCC

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

3I1. COBOL conversion Problems & Solutions

calling a script from a COBOL program

        identification division.
       * datetest - demo calling a script from a COBOL program
       *          - test program from UVSI www.uvsoftware.ca Jan28/06
       * - get system date & store value in environment-variable RUNDATE
       *   (demos DISPLAY environment-name/environment-value technique)
       * - then call a script which will display the value of RUNDATE
       * Note - only scripts called by this program inherit RUNDATE
       *      - but echo $RUNDATE will not show the new value of RUNDATE
       * IE - the parent(shell) is not affected by changes in child env
        program-id. datetest.
        data  division.
        working-storage section.
        01 workstore.
            05 sysdates.
               10 sysdate2-ymd8    pic x(8).
               10 sysdate2-mdy8e   pic x(10).
       *          sysdate2-ymd8  = 'yyyymmdd'
       *          sysdate2-mdy8e = 'mm/dd/yyyy'
       *
        procedure division.
        mainline.
       * get system date & display upon env-var RUNDATE
            accept sysdate2-ymd8 from date yyyymmdd.
       *
            move 'mm/dd/yyyy'        to sysdate2-mdy8e
            move sysdate2-ymd8(5:2)  to sysdate2-mdy8e(1:2)
            move sysdate2-ymd8(7:2)  to sysdate2-mdy8e(4:2)
            move sysdate2-ymd8(1:4)  to sysdate2-mdy8e(7:4)
       *
            display "RUNDATE" upon environment-name.
            display sysdate2-mdy8e upon environment-value.
       *
       * call a script to display $RUNDATE
            call "system" using "showrundate".
            stop run returning 0.
       *
       *notes - you cant run this program & then "echo $RUNDATE"
       *        because the child (this program)
       *        never affects the environment of the parent (your shell)
       *      - the called script could be anywhere in your PATH
       *        & could be just 1 line as follows:
       *
       *        echo "showrundate: RUNDATE=$RUNDATE"
       *        ====================================
       ******************* end datetest.cbl *************************

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

Part_4 JCL/COBOL/DATA Conversion Aids

Conversion Aids

Note
  • the conversion aids are in a separate document CNVaids.htm, which
    should be useful to JCL, COBOL,& DATA conversions
  • references below are all links into the common CNVaids.htm

Introduction & Overview

This document is intended to make you aware of the many conversion, testing, & debugging aids supplied by the Vancouver Utilities, that should help you to convert mainframes to unix/linux.

I believe you will find many of these aids essential to the success of your conversion, testing,& debugging.

These aids were originally in several documents (JCLcnv1demo,MVSCOBOL,MVSDATA,etc). In January 2008, a separate document (CNVaids) was created to avoid the duplications in the original documents, which now have links to CNVaids.htm.

Many of these aids are illustrated using supplied test/demo files & you can run many of these once you have installed the Vancouver Utilities. These 'practice sessions' will help you when you start working on your own conversions of JCL, COBOL,& DATA files.

Links to other documents

The intention is to give you a short introduction to the various utilities available, and then give you a link to the complete documentation which could be in various other books.

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

CNVaids.doc Vancouver Utility Conversion Aids

Unix/Linux Aids - Contents

CNVaids.htm#1A1 Profiles

stub_profile
  • modify & copy to user homedirs
common_profile
  • called by 'stub_profile'

CNVaids.htm#1B1 aliases

CNVaids.htm#1C1 Rename scripts

CNVaids.htm#1D1 dtree

CNVaids.htm#1E1 llr

CNVaids.htm#1F1 statdir1

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

Unix/Linux Aids - Contents

CNVaids.htm#1G1 diff

CNVaids.htm#1G2 alldiff

CNVaids.htm#1H1 grep

CNVaids.htm#1I1 dos2unix

CNVaids.htm#1I1 unix2dos

CNVaids.htm#1J1 Vancouver Utility backup scripts scheduled by cron

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

CNVaids.doc Vancouver Utility Conversion Aids

Vancouver Utility General Purpose Aids - Contents

CNVaids.htm#2A1 uvlp__

CNVaids.htm#2B1 listall

CNVaids.htm#2C1 spreadA

CNVaids.htm#2D1 cleanup

CNVaids.htm#2E1 verifytext

CNVaids.htm#2F1 grepsum1

CNVaids.htm#2G1 scan/replace

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

CNVaids.doc Vancouver Utility Conversion Aids

Cross-References - COBOL & JCL/scripts

CNVaids.htm#3A1 cross-refs summary

CNVaids.htm#3B1 - xrefall generate ALL Cross-Ref reports

CNVaids.htm#3B2 - xref... generate any 1 Cross-Ref report

COBOL Cross-Ref sample reports

 CNVaids.htm#3C1 - xcobcopy1 list all COPYBOOKS in any 1 PROGRAM
 CNVaids.htm#3C1 - xcobcopy2 crossref all PROGRAMS copying any 1 COPYBOOK
 CNVaids.htm#3C2 - xcobcall1 list of all CALLED-PROGRAMs in each PROGRAM
 CNVaids.htm#3C2 - xcobcall2 crossref all PROGRAMS calling any 1 CALLED-PROGRAM
 CNVaids.htm#3C3 - xcobfile2 crossref all PROGRAMS using each external-file
 CNVaids.htm#3C4 - xcobsql1 list all SQL Includes in any 1 PROGRAM
 CNVaids.htm#3C4 - xcobsql2 crossref all PROGRAMS using any 1 SQL Include

JCL Cross-Ref sample reports

CNVaids.htm#3D1 - xkshfile1 list all DATAFILES used in any 1 ksh SCRIPT CNVaids.htm#3D1 - xkshfile2 crossref show all SCRIPTs using any 1 DATAFILE CNVaids.htm#3E1 - xkshprog1 list all PROGRAMs executed in any 1 ksh SCRIPT CNVaids.htm#3E1 - xkshprog2 crossref show all SCRIPTS executing any 1 PROGRAM

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

CNVaids.doc Vancouver Utility Conversion Aids

Table Summaries & Statistics - Contents

CNVaids.htm#4B1

statallmvs1
  • table summaries of COBOL, MVS JCL,& Korn shell scripts
statallvse1
  • same, but for VSE JCL
statmvsjcl1
  • table summarize mainframe JCL programs & files
  • counts each program & top-node used in all JCLs
statvsejcl1
  • same, but for VSE JCL
statksh1
  • table summarize converted scripts programs & files
  • counts each program & top-node used in all scripts

CNVaids.htm#4C1 - statlogin1

CNVaids.htm#4D1 - table2

CNVaids.htm#4D2 - table3d

CNVaids.htm#4E1 - tblexts1

CNVaids.htm#4F1 - recsizes1

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

CNVaids.doc Vancouver Utility Conversion Aids

COBOL aids - Contents

CNVaids.htm#3A1 - COBOL cross-refs documented with JCL/script cross-refs

CNVaids.htm#5B1 - statcbl1

CNVaids.htm#5C1 - cobfil51

CNVaids.htm#5C1 - Animation

CNVaids.htm#5D1 - cobmap1

CNVaids.htm#5F1 - Micro Focus COBOL 'file status' error codes

CNVaids.htm#5F2 - Micro Focus COBOL 'run time' error codes

https://supportline.microfocus.com/Documentation/books/sx40sp1/smpubb.htm

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

CNVaids.doc Vancouver Utility Conversion Aids

JCL/script Test/Debug Aids - Contents

CNVaids.htm#6A1 - jobflow51

CNVaids.htm#6B1 - joblog

CNVaids.htm#6C1 - separate datafiles

CNVaids.htm#6D1 - lastgenr

CNVaids.htm#6E1 - getEtime

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

CNVaids.doc Vancouver Utility Conversion Aids

Data File Aids - Contents

CNVaids.htm#7A1 uvhd

CNVaids.htm#7B1 uvhdcob

CNVaids.htm#7B2 uvhdc

CNVaids.htm#7C1 uvcp

CNVaids.htm#7D1 uvcpF2L

CNVaids.htm#7D2 uvcpL2F

CNVaids.htm#7E1 CMPjobs

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

CNVaids.doc Vancouver Utility Conversion Aids continued

Data File Aids - Contents (continued)

CNVaids.htm#7F1 listrec2

CNVaids.htm#7F2 listhex2

CNVaids.htm#7G1 gentest1

CNVaids.htm#7H1 vtocr1

 - create VTOC report for files converted from mainframe
 - provides record counts, indexed keys, etc
 (information not displayed by the usual unix/linux tools)
 - see sample report & operating instructions in MVSDATA.htm

CNVaids.htm#7I1 uvsort

CNVaids.htm#7J1 uxcp

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

CNVaids.doc Vancouver Utility Conversion Aids

Pre-Programmed uvcopy jobs

CNVaids.htm#Part_8 pre-programmed jobs (written in uvcopy code)

CNVaids.htm#8B1 - tabfix1

CNVaids.htm#8C1 - tolower

CNVaids.htm#8D1 - toascii

CNVaids.htm#8E1 - scand2

CNVaids.htm#8F1 - acum1

CNVaids.htm#8G1 - cmrpt1

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

CNVaids.doc Vancouver Utility Conversion Aids

CNVaids.htm#8H1 - selectf1

CNVaids.htm#8J1 - splitjclproc1

CNVaids.htm#8K1 - splitcblcpy1

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

CNVaids.doc Vancouver Utility Conversion Aids

Tips for users new to Unix/Linux - Contents

CNVaids.htm#9A1 vi editor tutorial for users new to unix/linux

CNVaids.htm#9B1 Work in your working directory & address files thru subdirs

CNVaids.htm#9B2 setup a 'tmp/' subdir in your working directories

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

Part_5. profile, Control Files, & Scripts for Vancouver Utility Conversions

profile, Control Files, & Scripts - CONTENTS

This section will list profiles, control files,& scripts recommended for the Vancouver Utility COBOL conversions & compiles.

The files listed here have been verified for the 'mvstest' test/demo system at UV Software. They should need only minor changes to run the supplied test/demos at customer sites (profile printer & COBOL compiler location).

However you will need to make bigger changes for your own COBOL & JCL conversions. See discussions in Part_6.


5A1. profiles for Unix/Linux
- supplied at /home/uvadm/env/...
- stub_profile, common_profile,& bashrc
- defines RUNDATA & RUNLIBS which allow production users to operate
  on production data & programmers to operate on test data.
- PATH to scripts includes the RUNLIBS variable
- RUNDATA is used by 'jobset51' which is inserted at the beginning of all
  scripts to determine which set of data directories is to be accessed.

5A3. Customizing the profile for Unix/Linux conversions
- define a laser printer destination appropriate for your site
- modify COBDIR depending on where you installed Micro Focus COBOL
- console logging may be activated by uncommenting the 'script' command at
  the end of profile.

5B1. search/replace table for COBOL conversion (ctl/cnvcob.tbl listed below)
- supplied at /home/uvadm/ctl/... or /home/uvadm/mvstest/ctl/...

5C0. scripts to convert COBOL programs (cnvMF51A)
- supplied at /home/uvadm/sf/IBM/...
- cnvMF51, cnvMF51A, cpyrcs1A
- alternatives for AIX COBOL cnvAIXcpyA & cnvAIXcblA

5D1. Compile Options control file (ctl/cobdirectives listed below)
- supplied at /home/uvadm/ctl/... or /home/uvadm/mvstest/ctl/...

5D2. File Handler Configuration file 'extfh.cfg' for Micro Focus COBOL
- IDXNAMETYPE=2 for '.dat' extension on data partition of indexed files

5E0. scripts to compile COBOL programs (1 or all, SX or NX, .ints or .exes)
- mfcbl1, mfcblA, mfcbl1x, mfnxcbl1, mfnxcblA, mfnxcbl2, mfnxcblB
- supplied at /home/uvadm/sf/IBM/...
- mfcbl1 & mfcblA listed here in Part_5, mfnxcbl1 listed in Part_9

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

5A1. profiles for Vancouver Utility Conversions

'profiles' provided in /home/uvadm/env

 /home/uvadm/env      <--- profiles provided here
 :-----stub_profile      - copy/rename to .profile (ksh) or .bash_profile (bash)
 :                       - defines RUNLIBS/RUNDATA for programmers & operators
 :-----common_profile    - common profile (called by stub_profile)
 :                         defines PATH's etc using $RUNLIBS/$RUNDATA
 :-----root_profile      - profile for root, copy to /root/.bash_profile (RedHat)
 :                         to access Vancouver Utility scripts & uvcopy jobs
 :
 /home/appsadm/env    <--- setup user 'appsadm' & copy from /home/uvadm/env/*
 :-----stub_profile      - customize & copy to homedirs .profile or .bash_profile
 :-----common_profile    - common profile (called by stub_profile)

Mainframe conversion sites should setup an application administrator userid 'appsadm', copy /home/uvadm/env/* to /home/appsadm/env,& customize profiles there depending on the locations of their libraries & data.

Do NOT customize profiles in /home/uvadm/env/... because they would be overwritten when a new version of Vancouver Utilities is installed.

We recommend the concept of 'stub' & 'common' profiles. The shell profile in each user's homedir is a 'stub' that calls 'common_profile' which are stored in /home/appsadm/env/...

  1. The supplied 'stub_profile' is copied to homedirs, renamed as '.bash_profile' for bash shell (Linux) & '.profile' for Korn shell (Unix), and then modified depending on whether the user is a programmer or operator. - defines RUNLIBS as testlibs for programmers OR prodlibs for operators - defines RUNDATA as testdata for programmers OR proddata for operators

  2. 'common_profile' then defines the 'PATH's using $RUNLIBS,$COBDIR,$UV,etc For example: export PATH=$PATH:$RUNLIBS/jcls (converted JCL/scripts). Defines software superdirs (uvadm, COBDIR, ORACLE_BASE, ORACLE_HOME, etc)

  3. '$RUNDATA' determines data-file locations indirectly as follows: $RUNDATA defines the superdir housing all data-files. All JCL/scripts call a common function 'jobset51' which changes directory to $RUNDATA (cd $RUNDATA). The JCL converter inserts jobset51 at the begining of all converted JCL/scripts and then addresses all data files relative to $RUNDATA.

Note that stub profiles must call 'common_profile' using '.' (dot execution), which means the 'export's made in the common_profile will still be effective on return to the users profile.

This system is a big advantage for any site with multiple users, it means the sysadmin can update common_profile once in 1 place & those changes are effective for all users.

See more explanations at: https://www.uvsoftware.ca/admjobs.htm#1B2

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

5A2. profiles for Vancouver Utilities on Unix/Linux

 ADMjobs.htm#1C1 - stub_profile
      - distributed in /home/uvadm/env/...
      - copy (to user homedirs) & rename depending on the desired shell
        (.bash_profile for bash, .profile for ksh)
      - modify RUNLIBS/RUNDATA differently for programmers or operators
        define RUNLIBS as testlibs for programmers OR prodlibs for operators
        define RUNDATA as testdata for programmers OR proddata for operators
      - contains user aliases, preferences, console logging on or off
      - modify TERM & 'stty erase' character depending on user's terminal
      - modify UVLPDEST to define a laser printer near the user
      - calls common_profile
 ADMjobs.htm#1C2 - common_profile, called by stub_profile
      - defines search PATHs to libraries & data based on $RUNLIBS & $RUNDATA
      - distributed in /home/uvadm/env/...
      - you should copy to /home/appsadm/env/ & customize there
        (to avoid overwriting when new versions of VU installed)
      - contains most items, allows updates in 1 place for all
      - modify TERM & 'stty erase' character depending on user's terminal
        (distribution has TERM=linux & stty erase '^?')
      - the common_profile should be correct for the majority of users
        & the stub profiles can be modified for the exceptions
      - change 'COBDIR' depending on where you have installed Micro Focus COBOL
 ADMjobs.htm#1C5 - bashrc
      - 'rc file' distributed in /home/uvadm/env/...
      - copy (to user homedirs) & rename depending on the desired shell
        (.bashrc for bash, .kshrc for ksh)
      - master version supplied without the '.' for visibility
      - required if you invoke another shell level (console logging script)
      - carries aliases & umask which get lost on another shell level
      - you should customize & store in /home/appsadm/env/...

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

5A3. conversion support files - profiles

customizing the profile for Unix/Linux conversions

  1. Modify TERM & 'stty erase' character depending on user's terminal (distribution has TERM=linux & stty erase '^?')


      export TERM=linux       # TERM - modify depending on your terminal
      #================       # (vt100,xterm,at386,ansi,etc)
      stty erase '^?'         # erase char - modify depending on your terminal
      #==============         #  '^?' for linux/at386, '^H' for vt100,ansi,xterm
  1. Change the laser printer name defined by 'UVLPDEST' (environmental variable used by uvlist (file list scripts uvlp12, etc), and by uvhd (hexdump file investigation utility).


      export UVLPDEST="-dlp0"     <-- change 'lp0' to your laser printer
      =======================
Note
  • TERM,erase,& UVLPDEST are defined in both stub_profile & common_profile
  • change them both, users may then change their stubs if required
  1. Change 'COBDIR', the environmental variable defining where Micro Focus COBOL is installed on your system


      export COBDIR=/home/cobadm/cobol  <-- change for your site
      ================================
Note
  • COBDIR is defined only in the 'common_profile'
  • since there is no need to have different COBDIRs for different users

setting up profiles in /home/appsadm/env

Please see ADMjobs.htm re setting up profiles in /home/appsadm/env. ADMjobs.doc recommends setting up an 'appsadm' account to store the profiles so they do not get overwritten when a new version of Vancouver Utilities is installed.

ADMjobs.htm recommends copying /home/uvadm/env/* to /home/appsadm/env/... Then make any site specific modifications in appsadm/env. One significant change is to modify the stub profiles to call the common profile from appsadm not uvadm. See the details in ADMjobs.htm.

You can run the test/demo conversions & executions in Part_1 without setting up appsadm, but you definitely should setup appsadm & modify profiles before starting your own JCL conversions.

The most important thing would be to modify RUNLIBS & RUNDATA depending on where you decide to store your Libraries & Data for Testing & Production.

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

5B1. Mainframe COBOL Conversion to Unix/Linux Micro Focus COBOL

Search/Replace table for COBOL converter

'cnvMF5' is the uvcopy job that performs COBOL conversions for MVS COBOL.

In addition to the COBOL program, these jobs expects to input a SEARCH/REPLACE table that you can customize to improve the COBOL conversion. The table is used primarily to resolve reserved word conflicts (fieldnames in the mainframe program that are considered 'reserved words' by unix/linux Micro Focus COBOL).

I suggest you perform a trial mass conversion of all programs & examine the errors to see if you can eliminate common recurring errors by adjusting the search/replace table. The 'all programs in directory' conversion methods save the .err files in the cblx output directory. A script is provided to print out the 1st page of each .err report to assist you in analysis and improvement of the search/replace table.

search/replace table for conversion

For the 1st trial conversion, you can copy the supplied table from 'uvadm' to your conversion libraries, for example:


 cp /home/uvadm/ctl/cnvcob5.tbl ctl
 ==================================

These are search/replace conversion tables (see cnvcob5.tbl listing next page). Most entries are used to modify the spellings of RESERVED words for MF COBOL that were not reserved words for mainframe COBOL. Here are 3 sample entries.

  name;~~~~~~~~~~~~~~~~~~~~~~~~ name1;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  next-page;~~~~~~~~~~~~~~~~~~~ page;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  upon conslog;~~~~~~~~~~~~~~~~ upon console;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

You will add entries to the table to solve problems discovered by compiling. You will then need to reconvert perhaps both copybooks & programs before recompiling.

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

5B2. Mainframe COBOL Conversion to Unix/Linux Micro Focus COBOL

cnvcob5.tbl - conversion table

 # ctl/cnvcob5.tbl - search/replace table for cobol convert job (cnvMF5)
 #                 - see complete detail in part 3 of MVSCOBOL.doc
 # - modify or add to this table depending on site requirements
 # - to change words that are now reserved in Unix/Linux Micro Focus compiler
 # - trailing ';' in search pattern matches a blank,period,comma,or semicolon
 # - these reserved word replacements were developed at Unisys OS3 sites
 # - where search words (left side) were user fieldnames (not reserved on OS3)
 # - might have to remove some for IBM sites where intended as reserved ??
 # 01-30 - search pattern (ended by 1st tilde)
 # 31-60 - replacement pattern (ended by 1st tilde)
 # 61-80 - optional qualifier (61 '=' present, '!' not present, '~' not used)
 #       - qualifier optional, if present it must be on same line as search
  examine ~~~~~~~~~~~~~~~~~~~~~ inspect ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  transform ~~~~~~~~~~~~~~~~~~~ inspect ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  kanal1;~~~~~~~~~~~~~~~~~~~~~~ page;~~~~~~~~~~~~~~~~~~~~~~~~= advancing ~~~~~~~~
  new-page;~~~~~~~~~~~~~~~~~~~~ page;~~~~~~~~~~~~~~~~~~~~~~~~= advancing ~~~~~~~~
  top-of-page;~~~~~~~~~~~~~~~~~ page;~~~~~~~~~~~~~~~~~~~~~~~~= advancing ~~~~~~~~
  top-of-form;~~~~~~~~~~~~~~~~~ page;~~~~~~~~~~~~~~~~~~~~~~~~= advancing ~~~~~~~~
  id division;~~~~~~~~~~~~~~~~~ identification division;~~~~~~~~~~~~~~~~~~~~~~~~~
  file-id;~~~~~~~~~~~~~~~~~~~~~ file-id1;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 left-justify;~~~~~~~~~~~~~~~~~left-justify1;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 right-justify;~~~~~~~~~~~~~~~~right-justify1;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  name;~~~~~~~~~~~~~~~~~~~~~~~~ name1;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  bell;~~~~~~~~~~~~~~~~~~~~~~~~ bell1;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  escape;~~~~~~~~~~~~~~~~~~~~~~ escape1;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  ignore;~~~~~~~~~~~~~~~~~~~~~~ ignore1;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  crt;~~~~~~~~~~~~~~~~~~~~~~~~~ crt1;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  auto;~~~~~~~~~~~~~~~~~~~~~~~~ auto1;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  previous;~~~~~~~~~~~~~~~~~~~~ previous1;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  disp;~~~~~~~~~~~~~~~~~~~~~~~~ disp1;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  cycle;~~~~~~~~~~~~~~~~~~~~~~~ cycle1;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  row;~~~~~~~~~~~~~~~~~~~~~~~~~ row1;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  col;~~~~~~~~~~~~~~~~~~~~~~~~~ col1;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  range;~~~~~~~~~~~~~~~~~~~~~~~ range1;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  timeout;~~~~~~~~~~~~~~~~~~~~~ timeout1;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  wait;~~~~~~~~~~~~~~~~~~~~~~~~ wait1;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 .99dr.~~~~~~~~~~~~~~~~~~~~~~~~.99db.~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  segment;~~~~~~~~~~~~~~~~~~~~~ segment1;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 (segment;~~~~~~~~~~~~~~~~~~~~~(segment1;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  cd;~~~~~~~~~~~~~~~~~~~~~~~~~~ cd1;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 (cd;~~~~~~~~~~~~~~~~~~~~~~~~~~(cd1;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  upon conslog;~~~~~~~~~~~~~~~~ upon console;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  printer;~~~~~~~~~~~~~~~~~~~~~ printer1;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  underline;~~~~~~~~~~~~~~~~~~~ underline1;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  writing;~~~~~~~~~~~~~~~~~~~~~ writing1;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  time-of-day;~~~~~~~~~~~~~~~~~ time-of-day1;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 ~~=============(end of table#1 marker '~~' in col 1&2)==========================

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

5B3. Mainframe COBOL Conversion to Unix/Linux Micro Focus COBOL

Alternative for AIX COBOL

 # aixcblrw.tbl - search/replace table for cobol convert job cnvAIXcbl
 #              - AIX COBOL Reserved Word search/replace table
 # also see unixwork3.cpy & unixproc3.cpy at www.uvsoftware.ca/mvscobol.htm#2E1
 # modify or add to this table depending on site requirements
 # to change words that are now reserved in Unix/Linux AIX COBOL compiler
 # trailing ';' in search pattern matches a blank,period,comma,or semicolon
 # 01-30 - search pattern (ended by 1st tilde)
 # 31-60 - replacement pattern (ended by 1st tilde)
 # 61-80 - optional qualifier (61 '=' present, '!' not present, '~' not used)
 #       - qualifier optional, if present it must be on same line as search
 #
  examine ~~~~~~~~~~~~~~~~~~~~~ inspect ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  transform ~~~~~~~~~~~~~~~~~~~ inspect ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  values ~~~~~~~~~~~~~~~~~~~~~~ value ~~~~~~~~~~~~~~~~~~~~~~~= pic ~~~~~~~~~~~~~~
  02  null ~~~~~~~~~~~~~~~~~~~~ 02  null1 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  new-page;~~~~~~~~~~~~~~~~~~~~ page;~~~~~~~~~~~~~~~~~~~~~~~~= after ~~~~~~~~~~~~
  top-of-page;~~~~~~~~~~~~~~~~~ page;~~~~~~~~~~~~~~~~~~~~~~~~= after ~~~~~~~~~~~~
  top-of-form;~~~~~~~~~~~~~~~~~ page;~~~~~~~~~~~~~~~~~~~~~~~~= after ~~~~~~~~~~~~
  page-top;~~~~~~~~~~~~~~~~~~~~ page;~~~~~~~~~~~~~~~~~~~~~~~~= after ~~~~~~~~~~~~
  hof;~~~~~~~~~~~~~~~~~~~~~~~~~ page;~~~~~~~~~~~~~~~~~~~~~~~~= after ~~~~~~~~~~~~
  new-page;~~~~~~~~~~~~~~~~~~~~ page;~~~~~~~~~~~~~~~~~~~~~~~~= before ~~~~~~~~~~~
  top-of-page;~~~~~~~~~~~~~~~~~ page;~~~~~~~~~~~~~~~~~~~~~~~~= before ~~~~~~~~~~~
  top-of-form;~~~~~~~~~~~~~~~~~ page;~~~~~~~~~~~~~~~~~~~~~~~~= before ~~~~~~~~~~~
  page-top;~~~~~~~~~~~~~~~~~~~~ page;~~~~~~~~~~~~~~~~~~~~~~~~= before ~~~~~~~~~~~
  hof;~~~~~~~~~~~~~~~~~~~~~~~~~ page;~~~~~~~~~~~~~~~~~~~~~~~~= before ~~~~~~~~~~~
  date written~~~~~~~~~~~~~~~~~ date-written~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  date compiled~~~~~~~~~~~~~~~~ date-compiled~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  suppress.~~~~~~~~~~~~~~~~~~~~. *>suppress.~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  initialize ~~~~~~~~~~~~~~~~~~ initialize1 ~~~~~~~~~~~~~~~~~= pic ~~~~~~~~~~~~~~
  move initialize ~~~~~~~~~~~~~ move initialize1 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1. There are 2 different search/replace table for Micro Focus & AIX COBOL, but actually the entries depend more on the particular site COBOL coding habits than whether Micro Focus or AIX COBOL.

  2. The idea is to perform the mass compiles, analyze the errors (uvcopy cnvaixerrs1),& then modify the search/replace table to fix the most prevalent errors.

  3. Alternatively, you might request UV Software to modify the COBOL scrubber if the desired change can not be made via the search/replace table.

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

5C0. Conversion Control files, Conversion Scripts,& Compile Scripts

scripts to automate COBOL conversion

The multi-step conversions that have been documented on previous pages can be simplified by using the following scripts (which combine multi-steps into one command). The scripts are listed on following pages.


5C1. cnvMF51 - convert 1 MVS program at a time (cbl0->cbl1->cbl2->cbls->cblx)
- prompts y/n before copying to cbls, for updates from the mainframe
- in case you want to do a 'diff' to see if any test/debug updates

5C2. cnvMF51A - convert All MVS programs (cbl0->cbl1->cbl2)
- you would then manually----> cp cbl2/* cbls
- and compile all programs---> mfcbl5A all

Alternatives for AIX COBOL: cnvAIXcpy1/cnvAIXcbl1 & cnvAIXcpyA/cnvAIXcblA

The initial conversions should be performed 'ALL programs in directory' but after that cnvMF51 will be most useful to convert 1 program at a time during the testing period when mainframe programs are updated & need to be transferred to & converted on Unix/Linux.


5C3. cpyrcs1A - extract record sizes from cobmaps
- record layouts created from copybooks by 'uvcopy cobmap1'
- load Indexed file to supply record sizes to cobfil51
- cobfil51 provides info on all files used in all COBOL programs

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

5C1. Conversion Control files, Conversion Scripts,& Compile Scripts

cnvMF51 - script to convert 1 MVS program at a time

 #!/bin/ksh
 # cnvMF51 - Korn shell script from UVSI stored in: /home/uvadm/sf/IBM/
 # cnvMF51 - script to convert 1 COBOL program at a time (IBM to UNIX)
 #           for program requiring re-conversion (after mass conversion)
 #           or for more programs transferred from mainframe
 #         - see COBOL conversion documentation MVSCOBOL.doc
 # - must have subdirs: cbl0,cbl1,cbl2,cbls,ctl,tmp & input must be in cbl0
 #Aug07/14 - cobfil55I changed to cobfil55aI (see uvcopy job $UV/pf/IBMcobfil55)
 #Sep14/15 - chg clop1 k1 to k0 do not insert qquotes on CALL names if not existing
 #
 print "\ncnvMF51 convert 1 program at a time (vs cnvMF51A for All programs)"
 print "cbl0------->cbl1------->ctl-------->cbl2 ------->cbls--------->cblx"
 print "    cleanup   identify OLS   convert      copy ?      compile ?\n"
 #
 if [[ -d cbl0 && -d cbl1 && -d cbl2 && -d cbls && -d ctl && -d tmp ]]; then :
 else echo "must have subdirs: cbl0,cbl1,cbl2,cbl2,cbls,ctl,tmp";exit 9;fi
 #
 if [[ ! -f "$1" ]]; then
    echo "usage:   cnvMF51 cbl0/program    <-- arg1 programname (in subdir cbl0)"
    echo "         ===================="
    echo "example: cnvMF51 cbl0/CAR100.cbl <-- cbl0 names UPPERcase .ext or not"
    echo "         ==================="
    echo "         cbl1/car100.cbl  <-- names will be lowercased .cbl add if not"
    echo "         ==============="
    exit 9; fi
 #
 dp1=$1; p1=$(basename "$1")
 typeset -l p2=$p1  # ensure output filename lower case
 p3=${p2%.*}.cbl    # remove any .extension & append .cpy
 #
 echo "CLEANUP has many options, see www.uvsoftware.ca/cnvaids.htm#2I1"
 clop1="q0i7c5e15g8j1k0l1n1s8t1"
 echo "default options=$clop1 (may enter overrides or null)"
 echo "example: enter 's0' to NOT clear columns 1-6 (overrides default s8)"
 read clop2
 #
 uvcopy cleanup,fili1=$dp1,filo1=cbl1/$p2,arg1=.cbl,uop=$clop1$clop2
 #==================================================================
 #
 echo "Next screen will prompt for COBOL CONVERTER options to override defaults"
 echo "- here are some options that some sites may want to change"
 echo "y1 (default) - clear cols 1-6 (cols 73-80 always cleared)"
 echo "y0 - retain cols 1-6 (do NOT clear)"
 echo "l_ - controls ORGANIZATION LINE SEQUENTIAL (vs RECORD SEQUENTIAL)"
 echo "l0 (default) - do NOT set OLS via keywords in card & printer filenames"
 echo "l1 - set by keywords in filenames (card,parm,sysin,etc)"
 echo "l2 - set by keywords in filenames (printer,sys011,report,etc)"
 echo "l8 - force all sequential files ORGANIZATION LINE SEQUENTIAL"
 echo "k_ - also use ctl/cobfil55aI to set ORGANIZATION LINE SEQUENTIAL files"
 echo "k0 - do NOT use ctl/cobfil55aI to determine OLS"
 echo "k1 - set OLS if recsize 80 on Input files"
 echo "k2 - set OLS if recsize 132/133 on Output files"
 echo "k4 - set OLS if matching cobfil55aI entry has 'L' in byte 46"
 echo "k7l0 - default/RECOMMENDED, unless problems creating cobfil55aI, else 'k0l3'"
 echo "Enter override options here or next screen (null accept default k7l0)"
 read ops2
 #
 uvcopy cnvMF5,fild1=cbl1,fild2=cbl2,uop=q1i7a1y1k7l0$ops2,arg1=$p3\
 ,fili3=ctl/cnvcob5.tbl,fili4=ctl/cobfil55aI
 #==================================================================
 #
 echo "$p3 converted to cbl2, copy to cbls (overwriting prior) & compile ? y/n"
 reply=n; read reply
 until [[ "$reply" = "y" || "$reply" = "n" ]]
    do echo "copy to cbls & compile y/n ?"; read reply; done
 if [[ "$reply" = "n" ]]; then echo "reply=$reply, exiting"; exit 1; fi
 #
 cp -f cbl2/$p3 cbls  # copy to final cobol source dir for compile & corrections
 #==================
 mfcbl1 $p3           #<-- attempt compile
 #=========
 exit 0

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

5C2. Conversion Control files, Conversion Scripts,& Compile Scripts

cnvMF51A - script to convert All MVS programs

 #!/bin/ksh
 # cnvMF51A - Korn shell script from UVSI stored in: /home/uvadm/sf/IBM/
 # cnvMF51A - convert all MVS mainframe COBOL programs to Micro Focus COBOL
 #         - see op. instrns at www.uvsoftware.ca/mvscobol.htm#Part_2
 #         - also see cnvMF51 for 1 program at a time
 #Aug07/14 - cobfil55I changed to cobfil55aI (see uvcopy job $UV/pf/IBM/cobfil55)
 #Sep14/15 - chg clop1 k1 to k0 do not insert quotes on CALL names if not existing
 #
 if [[ "$1" != "all" ]]; then
    echo "usage: cnvMF51A all  <--arg1 'all' to convert programs cbl0->cbl1->cbl2"
    echo "       ============"
    exit 1; fi
 #
 echo "convert all COBOL programs "
 echo "cbl0------->cbl1------->ctl-------->cbl2 ------->cbls--------->cblx"
 echo "    cleanup   identify OLS   convert      copy ?      compile ?"
 reply=x; until [[ "$reply" = "y" || "$reply" = "n" ]]
    do echo "convert all programs: cbl0-->cbl1-->cbl2-->cbls-->cblx y/n ?"
       read reply; done
 if [[ "$reply" = "n" ]]; then echo "reply=$reply, exiting"; exit 1; fi
 #
 if [[ -d cbl0 && -d cbl1 && -d cbl2 && -d cbls && -d ctl && -d tmp ]]; then :
 else echo "must have subdirs: cbl0,cbl1,cbl2,cbl2,cbls,ctl,tmp";exit 9;fi
 #
 #Jul0714 - clear output subdirs cbl1 & cbl1, later prompt copy to cbls
 rm -f cbl1/* cbl2/*
 #
 echo "Next step calls CLEANUP job with options defaulted for most sites"
 echo "- see cleanup options at: www.uvsoftware.ca/cnvaids.htm#2D1"
 echo "  OR enter 'uvcopy cleanup' on 2nd screen (then cancel)"
 clop1="q0i7c5e15g8j1k0l1n1s8t1"
 echo "cleanup default options=$clop1 (may enter overrides or null)"
 echo "enter cleanup option overrides (null default) --> "
 read clop2
 #
 uvcopyx cleanup cbl0 cbl1 arg1=.cbl,uop=$clop1$clop2
 #===================================================
 # - cleanup mainframe code (clear 1-6, 73-80, lower case except in quotes)
 #
 reply=x; until [[ "$reply" = "y" || "$reply" = "n" ]]
 do echo "generate ctl/cobfil55aI to determine ORG Line Seqntl y/n ?"
    echo "- then run cnvMF5 with option 'k4' (or k7) to lookup ctl/cobfil55aI"
    echo "  to Identify ORG LINE SEQNTL by cnvMF51 option k4/k7"
    echo "  or use 'k7' to also id OLS files by recsize 80 or 132/133"
    echo "  or select option 'l3' to ID OLS by keywords (k7 recommended)"
    echo "  see: https://www.uvsoftware.ca/mvscobol.htm#6G2"
    echo "Note - later screen will prompt for override options"
    echo "- default options 'k7l0' to use ctl/cobfil55aI (recommended)"
    echo "- or use options  'k0l3' to use only keywords"
    echo "generate ctl/cobfil55aI to determine Line Seqntl files y/n ?"
    read reply; done;
 #
 if [[ $reply = "y" ]]; then
    uvcopy cobfil55,fild1=cbl1,fild2=maps,filo1=ctl/cobfil55a,filo2=ctl/cobfil55b,uop=q0i7,rop=r0
    #============================================================================================
    # - create sequential file of cobol file info
    #
 uvsort "fili1=ctl/cobfil55a,rcs=127,typ=LST,filo1=ctl/cobfil55aI,typ=ISF\
 ,key1=0(44),isk1=0(44),del1=0(1):*"
    #=====================================================================
    # - load sequential info into indexed file for lookup by cnvMF5
    echo "created ctl/cobfil55aI to Identify ORG Line Seqntl files"
    #
 uvsort "fili1=ctl/cobfil55b,rcs=127,typ=LST,filo1=ctl/cobfil55bI,typ=ISF\
 ,key1=0(44),isk1=0(44),del1=0(1):*"
    #=====================================================================
    # - load Indexed file for lookup by jclunix53.c
    echo "created ctl/cobfil55bI to supply record-sizes to JCL converter"
 fi
 echo "Next screen will prompt for COBOL CONVERTER options to override defaults"
 echo "- here are some options that some sites may want to change"
 echo "y1 (default) - clear cols 1-6 (cols 73-80 always cleared)"
 echo "y0 - retain cols 1-6 (do NOT clear)"
 # echo "t1 - translate to lowercase except in quotes (recommended)"
 # echo "t2 - translate to UPPERcase, t0 (default) leave as is from cleanup"
 echo "l_ - controls ORGANIZATION LINE SEQUENTIAL (vs RECORD SEQUENTIAL)"
 echo "l0 (default) - do NOT set OLS via keywords in card & printer filenames"
 echo "l1 - set by keywords in filenames (card,parm,sysin,etc)"
 echo "l2 - set by keywords in filenames (printer,sys011,report,etc)"
 echo "l8 - force all sequential files ORGANIZATION LINE SEQUENTIAL"
 echo "k_ - also use ctl/cobfil55aI to set ORGANIZATION LINE SEQUENTIAL files"
 echo "k0 - do NOT use ctl/cobfil55aI to determine OLS"
 echo "k1 - set OLS if recsize 80 on Input files"
 echo "k2 - set OLS if recsize 132/133 on Output files"
 echo "k4 - set OLS if matching cobfil55aI entry has 'L' in byte 46"
 echo "k7l0 - default/RECOMMENDED, unless problems creating cobfil55aI"
 echo "Enter override options here or next screen (null accept default k7l0)"
 read ops2
 #
 uvcopy cnvMF5,fild1=cbl1,fild2=cbl2,uop=q1i3y1k7l0$ops2\
 ,fili3=ctl/cnvcob5.tbl,fili4=ctl/cobfil55aI
 #=======================================================
 # - convert mainframe COBOL to Micro Focus COBOL
 #
 echo "cnvMF51A COBOL conversion complete (results in cbl2 subdir)"
 echo "- copy to cbls AND compile all programs n/y/g ? "
 echo "- n=no, y=compile to .ints(animation), g=compile to .gnts"
 echo "cp -f cbl2/* cbls   <-- OR you could copy manually like this"
 echo "================="
 echo "mfcblA all          <-- AND compile all programs like this"
 echo "==========              (or use mfcblAg for .gnts)"
 reply=""
 until [[ "$reply" = "n" || "$reply" = "y" || "$reply" = "g" ]]
    do echo "copy to cbls & compile ? (n=No, y=compile .ints, g=compile .gnts)"
    read reply; done
 if [[ "$reply" = "y" ]]
    then cp cbl2/* cbls    #<-- copy programs to compile subdir
         mfcblA all        #<-- compile all programs to .int's
    elif [[ "$reply" = "g" ]]; then
         cp cbl2/* cbls    #<-- copy programs to compile subdir
         mfcblAg all       #<-- compile all programs to .gnt's
 fi
 exit 0

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

5C3. Conversion Control files, Conversion Scripts,& Compile Scripts

cpyrcs1A - extract record sizes from cobmaps

 #!/bin/ksh
 # cpyrcs1A - extract rcsz from COBOL copybook maps file
 #          - sort & load Indexed file for 'cobfil51'
 #            to get recsize for copybooks
 #          - by Owen Townsend, UV Software, Jan14/2010
 #
 #           ** sample input file **
 #
 # lcfsdg02.cpy                  rcs=00131
 # tfom600.cpy                   rcs=00075
 # ctdbcpca.cpy                  rcs=00035
 #
 echo "extract rcsz from copybook maps, sort/load Indexed file ctl/cpyrcs1I"
 echo " - for cobfil51 (COBOL files report) to get recsize for copybooks"
 if [[ ! -d "$1" ]]; then
    echo "usage: cpyrcs1A maps   <-- arg1 subdir of copybook maps"
    echo "       ============="
    exit; fi
 #
 echo "also convert copybooks to maps y/n ? (n saves time if already done)"
 read reply;
 if [[ "$reply" == "y" ]]; then
    uvcopyx cobmap1 cpys maps uop=q0i7p0
    #===================================
 fi
 uvcopy cpyrcs1,fild1=maps,filo1=ctl/cpyrcs1,rop=r0
 #=================================================
 #
 uvsort "fili1=ctl/cpyrcs1,rcs=256,typ=LST,filo1=ctl/cpyrcs1I,rcs=80,typ=ISF\
 ,isk1=0(20),key1=0(20)"
 #==============================================================================
 exit

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

5D1. Conversion Control files, Conversion Scripts,& Compile Script s

COBOL Options/Directives for Server-Express

 # cobdirectives - Directives for Micro Focus COBOL Server Express (Unix/Linux)
 #               - for batch compile of COBOL programs migrated from mainframe
 # - see more at www.uvsoftware.ca/mvscobol.htm#Part_5
 # location of this file defined in compile scripts mfcbl1 & mfcblA as follows:
 #
 # export COBOPT=$(pwd)/ctl/cobdirectives  <-- if file exists
 # export COBOPT=$UV/ctl/cobdirectives     <-- else here
 # export UV=/home/uvadm                   <-- UV defined in common_profile
 #
 # ===================================
 # choose 1 of: ANS85, COBOL370, OSVS, VSC2, ENTCOBOL
 -C ENTCOBOL
 -C CASE
 -C IBMCOMP
 -C INDD(SYSIN)
 -C OUTDD(SYSOUT)
 -C LIST()
 -C FORM(56)
 -C PERFORM-TYPE(OSVS)
 -C NOSEG
 -C SIGN(ASCII)
 -C SOURCEFORMAT(FIXED)
 -C NOMFCOMMENT
 -C SPZERO
 -C NOCHECKNUM
 # -C FILESHARE
 # -C NOODOSLIDE
 #
 #                       ** Database Directives **
 #           (uncomment 1 of the following & modify as required)
 # -C SQL(dbman==ODBC)
 -C SQL(dbman==ODBC,TARGETDB==MSSQLSERVER)
 #  --> above works, but following gives error "1507U illegal command line"
 # -C SQL(dbman==ODBC,TARGETDB==MSSQLSERVER,BEHAVIOUR==ANSI)
 # -C SQL(dbman==ODBC,TARGETDB==MSSQLSERVER,BEHAVIOUR==MAINFRAME,DIALECT==MAINFRAME,NOCHECK)
 #
 # -C SQL(targetdb==ORACLEOCI)
 # -C "DB2(init==prot db==ar)"
 # -C "preprocess(cobsql) cobsqltype==ORACLE8 end-c comp5==yes endp"
 #
 #  Use "preprocess(cobsql) ... to invoke ORACLE PRO*COBOL automatically
 #  Better than running procobol separately prior to compile
 #  animation then shows EXEC SQL stmts (vs many generated lines)
 #  (NO directive required if calling ProCOBOL separately before compiler)
 #
 #  OpenESQL targetdb= alternatives to above "preprocess(cobsql) ..."
 #  could be DB2,MSSQLSERVER,ORACLEOCI,etc
 #
 #               ** compile 'options' vs directives **
 # Compile 'options' (such -a -P -x etc) cant be spcfd here
 # but rather in the compile script on the 'cob' command line
 # -a for animation (generate .int & .idy)
 # -g for native code (.gnt)
 # -x compile to executable (not required for batch, use cobrun .int)
 # -P to create the listing in subdir cblst/progname.lst
 #
 #             ** 'file configuration' vs COBOL directives **
 # File configuration options may be specified in a 'extfh.cfg' file
 # - see listing at www.uvsoftware.ca/mvscobol.htm#5D1
 #------------------------------------------------------------------

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

5D2. Conversion Control files, Conversion Scripts,& Compile Script s

extfh.cfg - file handler config for MF COBOL

 # extfh.cfg - File Handler Configuration file for Micro Focus COBOL
 # - see https://supportline.microfocus.com/Documentation/books/sx40sp/fh...
 # - see www.uvsoftware.ca/mvscobol.htm#5D2 & www.uvsoftware.ca/vsecobol.htm#5D2
 #
 # Location of this file defined by variable EXTFH in compile scripts as follows:
 #   export EXTFH=$UV/ctl/extfh.cfg    # COBOL File Handler Configuration
 #   ==============================
 #   export UV=/home/uvadm             # UV default definition in common_profile
 # See compile scripts mfcbl1 & mfcblA in $UV/sf/IBM/mfcbl1 & mfcblA
 #
 # Compile scripts also define location of COBOL directives as follows:
 #   export COBOPT=$UV/ctl/cobdirectives  # directives (-C options)
 #---------------------------------------------------------------------------
 # [XFH-DEFAULT]      - following options apply to all files
 #                    - unless over-ridden by [INTERNAL:EXTNAME] (see below)
 #
 #  IDXFORMAT=1       - create all indexed files as IDX1 (fixed lth < 2 gig)
 #  IDXFORMAT=8       - create all indexed files as IDX8 (allows > 2 gig)
 #    default         - IDXFORMAT unspecified would create fixed lth IDXFORMAT1,
 #                      & variable length as IDXFORMAT3 ? or IDXFORMAT8 ?
 #  $SET IDXFORMAT(3) - alternative way to set IDXFORMAT
 #                    - insert $SET IDX... in COBOL source ('$' in col 7)
 #
 #  IDXNAMETYPE=2     - means data partitions have '.dat' extension
 #                    - index partitions always have '.idx' extension
 #                    - IDXFORMAT=8 files have only 1 partition
 #                      & it will have '.dat' extension if IDXNAMETYPE=2
 #                      & does include the indexes (in spite of its name)
 #
 #  FILEMAXSIZE=4     - 4 byte offsets restricts files to 2 gigs
 #                    - might need 4 byte offsets for compatibility
 #  FILEMAXSIZE=8     - 8 byte offsets file size gargantuan
 #  FILEPOINTERSIZE=8 - allow IDX8 files > 256 Terrabytes (dont need)
 #---------------------------------------------------------------------------
 [XFH-DEFAULT]
 IDXFORMAT=1
 IDXNAMETYPE=2
 FILEMAXSIZE=8
 #
 #---------------------------------------------------------------------------
 #  -- OR -- you can assign characteristics to individual files as follows:
 # [INTERNAL:EXTNAME] - following options apply to a specific file ID by EXTNAME
 #                      on: 'select cobolFDname assign external EXTNAME'
 #                    - applies only to file defined by EXTNAME matching env-var
 #                      export EXTNAME=pathname (in JCL/script prior to cobrun)
 #                                 - - - examples - - -
 # [INTERNAL:E212853] - example for file whose EXTNAME=E212853 (select external)
 #  IDXFORMAT=1       - force IDXFORMAT1 vs any [XFH-DEFAULT] IDXFORMAT_
 # [INTERNAL:E212002] - example for file whose EXTNAME=E212002 (select external)
 #  IDXFORMAT=8       - force IDXFORMAT8 vs any [XFH-DEFAULT] IDXFORMAT_
 #---------------------------------------------------------------------------

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

5E0. Conversion Control files, Conversion Scripts,& Compile Script s

scripts for COBOL compiles

Here is a summary of the scripts used for COBOL compiles. The '*' indicates scripts that are listed on the following pages.

 *mfcbl1    - compile 1 program to .int/.idy for Unix/Linux ('5E1').
 *mfcblA    - compile All programs to .int/.idy for Unix/Linux ('5E2').
  mfcbl1x   - compile 1 program to executable for Unix/Linux
            - for faster execution if a lot of table indexing
 *mfnxcbl1  - compile 1 program to .int/.idy on SFU/UWIN/CYGWIN ('9C3').
  mfnxcblA  - compile All programs to .int/.idy on SFU/UWIN/CYGWIN
  mfnxcbl2  - compile 1 program to .exe's on SFU/UWIN/CYGWIN
  mfnxcblB  - compile All programs to .exe's on SFU/UWIN/CYGWIN

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

5E1. Conversion Control files, Conversion Scripts,& Compile Scripts

 #!/bin/ksh
 # mfcbl1  - Korn shell script from UVSI stored in: /home/uvadm/sf/IBM/
 # mfcbl1  - compile 1 program to .int for animation
 #         - copies source to outdir cblx (required for animation)
 #         - must be in library superdir with following subdirs:
 #           (cbls=cobolsource, cpys=copybooks, cblx= output)
 #         - see MVSCOBOL.doc/VSECOBOL.doc for Operating Instructions
 pgm="$1"; cbls="cbls"; cblx="cblx";  # capture progname, default input subdir
 test -n "$2" && cbls="$2";  # if arg2 subdir spcfd - use it (vs dflt cbls)
 test -n "$3" && cblx="$3";  # if arg2 subdir spcfd - use it (vs dflt cbls)
 if [[ ! -f "$cbls/$pgm" ]]; then
    echo "USAGE: mfcbl1 progname.cbl [cbls] [cblx]"
    echo "       ================================="
    echo " - arg1 progname mandatory, arg2 default cbls/, arg3 default cblx/"
    exit 1; fi
 #
 cwd=$(pwd)                      # capture Current Working Directory
 # specify copybook searchpath for MF COBOL
 export COBCPY=$cwd/cpys:$cwd/sqls:$COBDIR/cpylib
 # - may need to add other copybook dirs, example for ORACLE:
 # export COBCPY=$cwd/cpys:$ORACLE_HOME/precomp/public
 #
 # establish COBOL options for Micro Focus COBOL compile
 if [[ -f $cwd/ctl/cobdirectives ]]; then
    export COBOPT=$cwd/ctl/cobdirectives # directives (-C options)
    export EXTFH=$cwd/ctl/extfh.cfg      # COBOL File Handler Configuration
 else
    export COBOPT=$UV/ctl/cobdirectives # directives (-C options)
    export EXTFH=$UV/ctl/extfh.cfg      # COBOL File Handler Configuration
 fi
 # convert any UPPER case progname to lower & remove any .ext (.cbl .cbl, etc)
 typeset -l ps=$pgm              # convert UPPER case progname to lowercase
 px=${ps%%.*}                    # remove any extension (.cbl, etc)
 rm -f $cblx/$px.*               # remove old versions of this program
 cp $cbls/$pgm $cblx             # copy source to outdir (for animation)
 cd $cblx                        # change to outdir to receive output files
 integer psl=$(wc -l < $pgm)     # capture line count in program
 cat >$px.err <<EOF              # init .err file w progname, will append errs
 #
 #compile: $pgm  Lines=$psl
 EOF
 cob -a -P -We -k$pgm -o $px >>$px.err 2>&1
 #=========================================
 coberr=$?
 cat $px.err | head
 # pxl1=$(wc -l $px.err); pxl2=${pxl1% *}; pxl3=${pxl2##* };
 # if [[ $pxl3 -gt 3 ]]; then
 #Jan11/10 - cob -Ws default, need -We to return non-0 for fail test
 # - alternate workaround above to test err rpt lines > 3
 if [[ $coberr -ne 0 ]]; then
      echo "#compile: $ps - *FAILED*"
      rm -f $px.cbl $px.int $px.idy
 else rm  -f $px.err; fi
 if [ -f $px.o   ]; then rm -f $px.o  ; fi
 cd $cwd                # change back up to CWD when compile began
 # if .lst was created (-P lst() option), move it to cblst directory
 if [ -f $cblx/$px.lst ]; then mv -f $cblx/$px.lst cblst; fi
 exit 0

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

5E2. Conversion Control files, Conversion Scripts,& Compile Scripts

compile All programs to .int/.idy for Unix/Linux Server-Express

 #!/bin/ksh
 # mfcblA - Korn shell script from UVSI stored in: /home/uvadm/sf/IBM/
 # mfcblA - script compile ALL programs in directory (for animation)
 #        - requires cobdirectives (see export COBOPT below)
 #
 #*mfcblA (this script) compile All programs .int/.idy Unix/Linux Server Express
 # mfcbl1 - compile 1 program to .int/.idy Unix/Linux Server Express
 # - see other scripts for Windows, etc in www.uvsoftware.ca/mvscobol.htm
 #
 #usage: mfcblA all [indir] [outdir] [listdir] [copydir] [options]
 #dflts: mfcblA all   cbls    cblx     cblst      cpys       -P
 #
 if [[ "$1" != "all" ]]; then
    echo "usage: mfcblA all [indir] [outdir] [listdir] [cpydir] [optns]"
    echo "       ======================================================"
    echo "       mfcblA all  cbls    cblx     cblst     cpys     -P"
    echo "       ======================================================"
    echo "- arg1 must be 'all' (directories default as shown)"
    exit 1; fi
 #
 # default indir, outdir,& copy bk dir to uv test/demo directories
 ds=cbls; dx=cblx; dl=cblst; dc=cpys; opts="-P -We"
 if [ -n "$2" ]; then ds=$2; fi
 if [ -n "$3" ]; then dx=$3; fi
 if [ -n "$4" ]; then dl=$4; fi
 if [ -n "$5" ]; then dc=$4; fi
 if [ -n "$6" ]; then opts=$6; fi
 #
 if [[ -d $ds && -d $dx && -d $dl && -d $dc ]]; then :
 else echo "usage: mfcblA all [indir] [outdir] [listdir] [cpydir] [optns]"
      echo "       mfcblA all   $ds    $dx    $dl     $dc   $opts"
      echo "       ======================================================"
      echo " - indir, outdir, listdir, cpydir must be directories"
      exit 1; fi
 #
 cwd=$(pwd)                      # capture Current Working Directory
 # specify copybook searchpath for MF COBOL
 #Sep29/2015 - $cwd/sqls added separate subdir for SQL copybooks
 export COBCPY=$cwd/$dc:$cwd/sqls:$COBDIR/cpylib
 # - may need to add other copybook dirs, example for ORACLE:
 # export COBCPY=$cwd/$dc:$ORACLE_HOME/precomp/public
 #
 # establish COBOL options for Micro Focus COBOL compile
 if [[ -f $cwd/ctl/cobdirectives ]]; then
    export COBOPT=$cwd/ctl/cobdirectives # directives (-C options)
    export EXTFH=$cwd/ctl/extfh.cfg      # COBOL File Handler Configuration
 else
    export COBOPT=$UV/ctl/cobdirectives # directives (-C options)
    export EXTFH=$UV/ctl/extfh.cfg      # COBOL File Handler Configuration
 fi
 #
 yn=x
 until [[ "$yn" = y || "$yn" = n ]]
    do echo "remove old prgms from $dx & $dl OK y/n ?"; read yn
    done
 if [[ "yn" = y ]]; then rm -f $dx/*; rm -f $dl/*; fi
 rm -f $dx/*.err             # ensure any old .err files removed
 start="$(date +%y%m%d:%H%M)"; echo "mfcblA started $start"
 typeset -RZ4 nt=0; nf=0
 for i in $ds/*
 do
   #------------------------------------------------------------------------
   let nt=nt+1                 # count total prgms in dir
   ps=${i##*/}                 # remove directory/ leaving progname.cbl
   px=${ps%%.*}                # remove .extension (.cbl .cob, etc)
   rm -f $dx/$px.*             # remove old versions of this program
   cp $ds/$ps $dx              # copy source to outdir (reqd for animation)
   cd $dx                      # change to outdir to receive output files
   integer psl=$(wc -l < $ps)  # capture line count in program
   cat >$px.err <<EOF
 #Compile#=$nt Program=$ps Lines=$psl
 EOF
   echo "start compile of: $ps"
   cob $opts -k$ps -o$px >>$px.err 2>&1
   #===================================
   coberr=$?
   head $px.err
   # pxl1=$(wc -l $px.err); pxl2=${pxl1% *}; pxl3=${pxl2##* };
   # if [[ $pxl3 -gt 3 ]]; then
   #Jan11/10 - cob $opts "-P -Ws" dflt, need -We to return non-0 for fail test
   # - alternate workaround above to test err rpt lines > 3
   if [[ $coberr -ne 0 ]]; then
        echo "#compile#$nt: $ps - *FAILED*"
        rm -f $px.cbl $px.int $px.idy
        let nf=nf+1
   else rm -f $px.err; fi
   if [ -f $px.o   ]; then rm -f $px.o  ; fi
   cd $cwd
   # if .lst was created (-P lst() option), move it to cblst directory
   if [ -f $dx/$px.lst ]; then mv -f $dx/$px.lst $dl; fi
   echo " "      # space between compiles
 done
 #------------------------------------------------------------------------
 echo "*** $nf compiles failed, of $nt total ***"
 echo "programs compiled from $ds to $dx"
 echo "copylibs=$COBCPY"
 echo "compile options file=$COBOPT"
 end="$(date +%y%m%d:%H%M)";
 echo "mfcblA started $start, ended $end"
 echo "- run cblerrs1 & cblerrs2 table summarize error reasons y/n ?"; read reply
 if [[ "$reply" == "y" ]]; then
 uvcopy cblerrs1,fild1=cblx,filo1=errs/cblerrs1.rpt,rop=q0i7r0
 uvcopy cblerrs2,fili1=errs/cblerrs1.rpt,filo1=errs/cblerrs2.rpt\
 ,filo2=errs/cblerrs2a.tbl,filo3=errs/cblerrs2b.tbl,rop=q0i7r0
 echo " "
 echo "       ** reports & table summaries listed below **"
 ls -l errs        # list error reports in subdir errs/...
 echo "errs/cblerrs1.rpt  - unsorted, 5 lines per failing program (do not list)"
 echo "errs/cblerrs2a.tbl - table summary by major fail reason     <-- list 1st"
 echo "errs/cblerrs2b.tbl - summary detail (missing copybooks,etc) <-- list 2nd"
 echo "errs/cblerrs2.rpt  - sorted, prognames & fail reason <-- correction guide"
 echo "uvlp12 errs/cblerrs2a.tbl  #<-- sample command to list reports"
 fi
 exit

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

Part_6 Converting YOUR Mainframe COBOL (vs supplied test/demos)

Converting YOUR Mainframe COBOL - CONTENTS


6A1. Unix/Linux file systems for Conversion & Production
6A2. Directory & File Design Principles
6A3. Libraries & Data directories for Conversion & Testing
6A4. Libraries & Data Directories for Production

6B1. $RUNLIBS & $RUNDATA - variables to control Testing or Production

6C1. Transfer Mainframe Libraries to Unix/Linux & Reorg into sub-dirs

6D1. Cleanup Library Modules & standardize module names
6D2. Ensuring Libraries are pure - no mixed modules

6F1. Directories used in Conversion Procedures

6G1. Op Instrns - convert All Copybooks in the direcory
6G2.  Op Instrns - convert All Programs in the direcory
6G2.  Identify files that should be Organization Line Sequential (OLS)
- using uvcopy cobfil55 to create Indexed file for converter lookup
6G3.  Op. Instrns for COBOL converter & options available
6G4.  sample cobfil55 OLS control file generated from cbl1 (before conversion)
6G5.  sample cobfil55 OLS control file generated from cbl2 (after conversion)
6G6.  Options 'l' & 'k' to control inserting OLS on select stmnts
6G7.  Op. Instrns to modify OLS by editing cobfil55 & reconverting
6G8.  Notes re editing xref/cobfil55a before 2nd conversion
6G9.  Op Instrns - optional conversions for SYSIN & SYSOUT

6H1. Op Instrns - compiling cobol Programs - 1 or ALL

6H2. Printing compile ERROR reports for correction guide
- 'mfcblA' compiles ALL programs & captures compile failure displays
- captures in output subdir as cblx/progname.err

6H3. Sample compile ERROR report
- 'uvlpd1p' script to print 1st page of compile failure reports
- usually the 1st error causes the remaining errors

6H4. Compile Error Summaries, report 1st few errors for compile failures
- operating instructions for uvcopy jobs cblerrs1 & cblerrs2

6H5. Sample reports summarized by compile failure reasons
- table summary by Major-Reason for failure
- table summary by Detail-Reason for failure

6H6. Sample detail report to be used as guide for program corrections
- sorted by failure reason showing progam name & 1st error
- shows 5 lines per program failure
- usually the 1st error causes the remaining errors

6I1. Recommendations to Investigate errors, correct, & re-compile

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

Converting YOUR Mainframe COBOL (vs supplied test/demos)

Converting YOUR COBOL - CONTENTS (continued)


6J1. Search/Replace tables to improve conversion

6K1. Scripts to Re-convert,& Re-compile - all programs or 1 at a time

6L1. diff, alldiff,& alldiff2 - utilities & scripts to verify changes

6M1. Before Starting Your Testing & Debugging
- Inventory lists, Cross-References, COBOL file reports
- Job-Flow reports (essential guide to testing & debugging)

6N1. Recommendations for Testing & Debugging
- copy each JCL/script to execution jcls just before testing begins

6O1. scripts to reconvert COBOL - 1 at a time or All in directory
- cnvMF51cpy & cnvMF51Acpy for copybooks, cnvMF51 & cnvMF51A for programs

6P1. table3d, uvcopy job to create table summary counts of various items
in COBOL & JCL to assist customization of mainframe conversions.

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

6A1. File System Design for YOUR Conversion, Testing,& Production

File System Design for YOUR Testing,& Production

Up to this point the directory design was intended only to test/demo the UV conversion procedures using the supplied JCL & COBOL programs. In Part_1 we setup test/demo directories in homedir (mvstest) for convenience & simplicity.

 /home
 :----user1
 :----user2
 :-----etc-
 :----mvstest           <-- $RUNLIBS
 :    :----cbls
 :    :----jcls
 :    :-----etc-
 :    :----testdata     <-- $RUNDATA
 :    :    :----ar
 :    :    :----gl
 :    :    :----etc

You should not use homedirs for your actual conversion, testing,& production for several reasons which will be explained below.

I recommend separate file systems for test-libraries, test-data, production-libraries, & production-data. This gives you a lot more flexibility for backups and any required restores. Separate file systems protects other file systems in case of runaway programs filling up the data file system. Other file systems are also protected against corruption in any 1 file system.

We have already explained how RUNLIBS & RUNDATA are defined in the profiles to control the locations of the active libraries (test or production) and the locations of the active data (test or production). From the following pages you can see that RUNLIBS & RUNDATA for programmers & production personnel might be:

 export RUNLIBS=/p1/testlibs       <-- testlibs/testdata for programmers

export RUNDATA=/p1/testdata

 export RUNLIBS=/p2/prodlibs       <-- prodlibs/proddata for operators

export RUNDATA=/p2/proddata

/p1, /p2, /p3, /p4 are file system mount points, which could be different on your system, but all our conversion scripts & generated JCL/scripts will work without change, since they all depend on RUNLIBS & RUNDATA, which are defined in the profiles of programmers & operators.

The next few pages will illustrate the details of testlibs/testdata & prodlibs/proddata, and also describe the uses of /p3 for backup/restore, and /p4 for data conversions.

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

6A2. Directory Design for YOUR Conversion, Testing,& Production

File System Design Overview

 /root
 /...              <-- unix/linux O/S directories
 /...
 /home             <-- home directories
 :----user1
 :----user2
 :----etc---
 :
 /p1               <-- /p1 file system mount point
 :----testlibs       - test-libraries & test-data
 :----testdata
 /p2               <-- /p2 file system mount point
 :----prodlibs       - production-libraries & production-data
 :----proddata
 /p3               <-- /p2 file system mount point
 :----backup         - backup & restore directories
 :----restore
 /p4               <-- /p2 file system mount point
 :----d1ebc          - data conversion directories
 :----d2asc

Note that this file design is the first practical design that you would want to use for your development & production. The earlier test/demos used home directories (/home/mvstest) which should not be used for your development & production because:

  1. The /home file system would not usually have sufficient space allocated for your large data files.

  2. You should have separate file systems to protect against runaway COBOL programs filling up the entire file system, rather than just the data file system. Other file systems are also protected against corruption in any 1 file system.

  3. You should have separate file systems designed to facilitate your backup & restore procedures. You should be able to do backup/restores separately for testlibs, testdata, prodlibs,& proddata.

  4. Separate file systems facilitate writing backup tapes with multiple archives. The restore script allows you to restore just the desired archive, rather than the entire tape, saving time & disc space.

    Alternative File System Designs

The next few pages will present the details of this 1st practical yet simple file system design. See alternative file designs in JCLcnv1demo.htm#Part_3 that allow for multiple companies &/or multiple separate applications. Also see ADMjobs.htm#Part_2 which discusses using RAID file systems.

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

6A3. Directory Design for YOUR Conversion, Testing,& Production

Libraries for Your Conversion & Testing

 /p1/testlibs
 :-----Csub          - C subroutines for COBOL programs
 :-MF--cbl0          - your COBOL programs transferred from mainframe
 :-----cbl1          - cleaned up, cols 1-6 & 73-80 cleared, etc
 :-----cbl2          - cnvMF5 converts mainframe COBOL to Micro Focus COBOL
 :-----cbls          - copy here (standard source library) before compiling
 :-----cblst         - cobol source listings from compiles
 :-----cblx          - compiled COBOL programs (.int's)
 :-MF--cpy0          - for COBOL copybooks
 :-----cpy1          - cleaned up, cols 1-6 & 73-80 cleared, etc
 :-----cpy2          - cnvMF5 converts mainframe COBOL to Micro Focus COBOL
 :-----cpys          - copy here (standard copybook library)
 :-----ftp           - subdir for FTP transfers
 :-UV--ctl           - conversion control files (jclunixop4, datafiles41)
 :-----include1      - optional (PROC expansion allows include files)
 :-MF--jcl0          - your JCLs transferred from mainframe
 :-----jcl1          - intermediate conversion 73-80 cleared
 :-----jcl2          - PROCs expanded from procs
 :-----jcl3          - JCLs converted to Korn shell scripts
 :-----jcls          - copy here manually 1 by 1 during test/debug
 :-----maps          - 'cobmaps' record layouts generated from copybooks
 :-----pf            - uvcopy jobs to replace utilities (easytrieve,etc)
 :-MF--proc0         - your PROCs transferred from mainframe
 :-----procs         - will be merged with jcl1, output to jcl2
 :-----sf            - for misc scripts you may wish to write
 :-UV--sfun          - korn shell functions (jobset41,logmsg,etc)
 :-----tmp           - tmp subdir used by various conversions
 :-----xref          - cross-references (see Part_9)

 mvslibsdirs      <-- script to create the directories shown above
 ===========

DATA Directories for Your Testing

 /p1/testdata
 :-----ap          <-- directories created for topnodes of filenames
 :-----ar
 :-----gl
 :-----py
 :-----jobctl      <-- standard directories shared by all applications
 :-----joblog
 :-----jobtmp
 :-----rpts
 :-----sysout
 :-----tmp
 :-----wrk

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

6A4. Directory Design for YOUR Conversion, Testing,& Production

Libraries for Your Production

 /p2/prodlibs
 :-----cbls          - end point for converted COBOL programs
 :-----cblst         - cobol source listings from compiles
 :-----cblx          - compiled COBOL programs (.int's)
 :-----cpys          - converted, ready for compiles
 :-----jcl3          - JCLs converted to Korn shell scripts
 :-----jcls          - copy here manually 1 by 1 during test/debug
 :-----pf            - uvcopy jobs to replace utilities (easytrieve,etc)
 :-----sf            - for misc scripts you may wish to write
 :-----sfun          - korn shell functions (jobset41,logmsg,etc)
 :-----tmp           - tmp subdir used by various conversions

Please compare these production libraries to the conversion & testing libraries on the preceding page. Note that many original mainframe & intermediate conversion subdirs have been dropped, retaining only the fully converted subdirs of COBOL programs, copybooks,& JCL(now Korn shell scripts).

DATA Directories for Your Production

 /p2/proddata
 :-----ap          <-- directories created for topnodes of filenames
 :-----ar
 :-----gl
 :-----py
 :-----jobctl      <-- standard directories shared by all applications
 :-----joblog
 :-----jobtmp
 :-----rpts
 :-----sysout
 :-----tmp
 :-----wrk

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

6B1. Converting YOUR Mainframe COBOL (vs supplied test/demos)

$RUNLIBS & $RUNDATA - control Testing or Production

  1. RUNLIBS & RUNDATA are environmental variables (in the profile of programmers & operators) that control access to JCL/scripts/programs & Data files.

  2. When programmers & operators enter JCL/script names to be executed, RUNLIBS (in the profile) determines which Library directories are searched (Test or Production).

  3. When the JCL/script executes, RUNDATA determines which directories of Data files are accessed (Test data or Production data).

Note
  • Most sites will have separate machines for Testing & production,
  • But RUNLIBS & RUNDATA are valuable constructs for the following reasons:
  1. RUNLIBS & RUNDATA mean you do not have to modify your JCL/scripts as you move them from testing machines to production machines. RUNLIBS & RUNDATA in the login profiles supply the top-level portion of the pathnames to the Libraries & Data files.

  2. RUNLIBS & RUNDATA allow you to run various systems separately on the same machine. This is important if you want to maintain separate console logs for the various systems.

  3. RUNLIBS & RUNDATA allow you to control which operators can run which systems. Operators cannot run unauthorized systems, since their profile PATH & RUNLIBS will not find the unauthorized JCL/scripts. Operators that need to run multiple systems would be provided with the multiple logins required. Terminal emulators make it easy to run the multiple sessions on 1 physical terminal.

  4. Dedicated logins can be used to enforce the tight control required for computer room batch shift operations. If you have separate companies or applications, you might setup logins to match (aaco,bbco,apay,arcv,etc).

  5. I suggest the above userids be used for your production operators. Your programmers would use their personal logins, but modify RUNLIBS & RUNDATA in their profile as required for testing the various systems.

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

6B2. Converting YOUR Mainframe COBOL (vs supplied test/demos)

RUNLIBS & RUNDATA in your profile

From previous discussions of Directory Design & recommended profiles, you might have the following in your profile.


 export RUNLIBS=/p1/testlibs
 ===========================

 alias cdl='cd $RUNLIBS'
 =======================

 export RUNDATA=/p1/testdata
 ===========================

 alias cdd='cd $RUNDATA'
 =======================

'$RUNLIBS' is referenced in the compile scripts & in the converted jcls. It is defined here as 'testlibs' for programmers, but it will be defined as 'prodlibs' in the profiles of production operators.

Change Directory to '$RUNDATA' is performed in the jobset4 function inserted at the begining of all converted JCL/scripts. It is defined here as 'testdata' for programmers, but it will be defined as 'proddata' in the profiles of production operators.

Note that the aliases makes it easy for you to get to RUNLIBS or RUNDATA


 cdl               <-- change to RUNLIBS easily
 ===

 cdd               <-- change to RUNDATA easily
 ===

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

6C1. Converting YOUR Mainframe COBOL (vs supplied test/demos)

Transfer Mainframe Libraries to Unix/Linux & Reorg into sub-dirs

  1. We assume the following libraries are available on the mainframe - COBOL source, copybooks, JCL, PROCs,& control-cards - We will copy entire libraries & select desired systems on Unix/Linux - might create tapes for transfer or FTP to Unix/Linux

  2. However transferred to Unix/Linux, we will assume the result will be 80 column text records. Transfer methods sometimes introduce carriage returns (not required for Unix/Linux) and our cleanup methods will strip these out and shorten the text records back to the last non-blank.

  3. We will assume transfer or FTP to a temporary directories on /p4 below for subsequent distribution to the desired libraries (possibly splitting by system if desired).

 p4/
 :-----IBMlibs
 :     :-----cbl
 :     :-----cpy
 :     :-----jcl
 :     :-----proc
 :     :-----ctlcdlib
  1. If there are multiple systems in these libraries, we might wish to separate on the Unix/Linux system. For example let us assume 3 distinct systems (apay, arcv, ordr). Our desired directories might be as follows: We will append a '0' on our library names to indicate that these are the original mainframe libraries (yet to be converted).

 /p4
 :-----testlibs
 :     :-----apay
 :     :     :-----cbl0
 :     :     :-----cpy0
 :     :     :-----jcl0
 :     :     :-----proc0
 :     :     :-----cclib0
 :     :-----arcv
 :     :     :-----cbl0
 :     :     :-----cpy0
 :     :     :-----jcl0
 :     :     :-----proc0
 :     :     :-----cclib0
 :     :-----ordr
 :     :     :-----cbl0
 :     :     :-----cpy0
 :     :     :-----jcl0
 :     :     :-----proc0
 :     :     :-----cclib0

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

6C2. Converting YOUR Mainframe COBOL (vs supplied test/demos)

Unix/Linux libraries/directories

Setup additional directories required for various conversions.

 /p1
 :-----testlibs      <-- testlibs/prodlibs on different filesystems/machines
 :     :-----cbl0        COBOL - original mainframe BATCH programs
 :     :-----cbl1              - CRs stripped,lowercase 'NOT IN QUOTES'
 :     :-----cbl2              - intermediate conversions
 :     :-----cbl3                (can go away after conversion)
 :     :-----cbls              - fully converted batch source
 :     :-----cblx              - compile output (.int .idy .cbl .err)
 :     :-----cblst           - compiler listings
 :     :-----cpy0        Copybooks - original mainframe source
 :     :-----cpy1              - CRs stripped, lowercased
 :     :-----cpys              - converted (& lower cased)
 :     :-----cpyu              - optional, for unpacking packed fields
 :     :-----cclib0      Control card library from mainframe
 :     :-----cclib1      Control card library cleaned up for Unix/Linux
 :     :-----ctl         Control files - conversion & ongoing
 :     :-----ftp               - libraries FTP'd from the mainframe
 :     :-----proc0       PROCs - original mainframe
 :     :-----procs             - CR's stripped, 73-80 cleared,
 :     :-----jcl0        JCL   - original mainframe source
 :     :-----jcl1              - CRs stripped, 73-80 cleared,
 :     :-----jcl2              - JCL with PROCs expanded
 :     :-----jcl3              - converted scripts before manual change
 :     :-----jcls              - modified, tested,& debugged
 :     :-----maps        COBOL copybook 'maps' (layouts) from cpys
 :     :-----mapu               - optional for unpacked layouts
 :     :-----tmp         TMPDIR   - required for various conversions
 :     :-----sf          scripts- misc scripts vs converted jcl
 :     :-----sfun        functions - KORN shell functions
 :     :-----xref        Cross-Refs - conversion & ongoing use

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

6C3. Converting YOUR Mainframe COBOL (vs test/demos)

Cleanup Library Modules

Library source (COBOL, JCL, SORT field members, etc) will be cleaned up prior to the actual conversion.

  1. Carriage Returns will be removed since Unix/Linux requires only 1 LineFeed vs CR+LF that may be present depending on how the transfer was performed.

  2. Excess trailing blanks will be removed and the LineFeed inserted following the last nonblank.

  3. Text contents of COBOL source & copybooks will be translated to lower case, except for text enclosed in quotes. You will want to do this on Unix/Linux since the 'vi' editor is hard to use on UPPER case text. The Micro Focus compiler is case insensitive. Literals in quotes will be left UPPER case which is required to match your mainframe data. The JCL is not translated to lower case, the JCL converter will create lower case where possible, but by convention environmental variables are UPPER case.

  4. Filenames within most subdirs will be converted to lower case which is much easier to key. You may be using these systems for a long time so let's set things up for long term ease of use.

  5. We might make an exception for the '0' libraries (cbl0,cpy0,jcl0,cclib0). If you have a variety of cases & extensions, it might be better to standardize on UPPER case names & no extensions. The cleanup jobs will transfer to the '1' libraries (cbl1,cpy1,jcl1,cclib1) changing to lower case with appropriate extensions.

  6. COBOL source, copybooks,& JCL will have columns 73-80 cleared. These were originally used for program names in the punch card days and are now pretty messy at most mainframe sites.

  7. COBOL source & copybooks will also have columns 1-6 cleared since they were used for sequence numbers in the punch card days & are usually now in an inconsistent state.

  8. Miscellaneous modules such as sort field specs etc might only need to have 'CR's removed, text shortened to last non-blank, & the output filename translated to lower case.

  9. Some sites might have COBOL source that begins in column 1 (vs column 7). See page '6E2' for a method of correcting this (required by Micro Focus COBOL).

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

6D1. Converting YOUR Mainframe COBOL (vs test/demos)

Transfer Mainframe Libraries to Unix/Linux/Windows

We will assume the Mainframe libraries of COBOL programs, CopyBooks,& JCL have been zipped & can be FTP'd to Unix/Linux/Windows. We will FTP to subdir 'ftp', and copy COBOLs to cb0, Copybooks to cp0,& JCLs to jc0, where they will be unzipped. The next section will then copy over to cbl0, cpy0,& jcl0 (where the standard conversions begin).

For this documentation, we will assume the mainframe libraries have been zipped into allcbl.zip, allcpy.zip,& alljcl.zip. The idea here is to give us a chance to investigate the mainframe modules & standardize them as we copy from cb0/cp0/jc0 to cbl0/cpy0/jcl0.

 If you don't have file naming problems, you can skip to '6F1' ----->

 #0. login testlibs ---> testlibs account
 #1. mkdir ftp cb0 cp0 jc0    <-- make subdirs if not already existing

 #2a. cd ftp                   <-- change into ftp subdir before FTP
 #2b. ftp aaa.bbb.ccc.ddd      <-- FTP to the mainframe
      ===================
      --> cd xxxx          - change to mainframe dir with
      --> lcd ftp          - change into Unix/Linux/Windows subdir
      --> binary           - ensure binary transfer
      --> get allcbl.zip   - get all COBOL programs
      --> get allcpy.zip   - get all COBOL CopyBooks
      --> get alljcl.zip   - get all JCL
      --> bye              - end FTP

 #2c. cd ..                    <-- change back to testlibs working dir

 #3a. cp ftp/allcbl.zip cb0   <-- copy zip archives to appropriate subdir
 #3b. cp ftp/allcpy.zip cp0
 #3c. cp ftp/alljcl.zip jc0

 #4a. cd cb0
 #4b. unzip allcbl.zip        <-- unzip COBOL programs
 #4c. cd ..

 #5a. cd cp0
 #5b. unzip allcpy.zip        <-- unzip CopyBooks
 #5c. cd ..

 #6a. cd jc0
 #6b. unzip alljcl.zip        <-- unzip JCLs
 #6c. cd ..

 #7a. rm cb0/allcbl.zip       <-- remove zip archives from subdirs
 #7b. rm cp0/allcbl.zip
 #7c. rm jc0/allcbl.zip

 #8a. spreadA cb0    <-- create 4-up listing of all COBOL filenames
 #8b. spreadA cp0    <-- create 4-up listing of all CopyBook filenames
 #8c. spreadA jc0    <-- create 4-up listing of all JCL filenames

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

6E1. Converting YOUR Mainframe COBOL (vs test/demos)

Standardizing Filenames

For the test/demo conversions (of COBOL, COPYBOOKS,& JCL), the inputs were in subdirs: cbl0, cpy0,& jcl0. All filenames were UPPER case with no extensions. But for real life mainframe conversions, we need to allow for a variety of extensions & UPPER or lower case.

To achieve our objective of standardized UPPER case filenames with no extensions, we will first copy our mainframe modules to subdirs cb0, cp0,& jc0. We can then copy/manipulate these subdirs over to our objective cbl0, cpy0,& jcl0 (the starting point for our documented conversions).

Here is an example showing the extra subdirs that may be required:

 /p1/testlibs
 :-----cb0    COBOL - original programs transferred from mainframe
                    - filenames with various extensions & UPPER or lower case
 :-----cb0C         - *.C extensions copied here
 :-----cb0CBL       - *.CBL extensions copied here
 :-----cbl0   COBOL - mainframe versions input to standard cleanup/conversion
                    - filenames UPPER case & No extensions
 :-----cbl1         - cleaned up, clear 1-6,73-80, lower case (except quotes)
                    - extensions standardized to '.CBL'
 :-----cbl2         - converted, via search/replace tables, assign external, etc
 :-----cbls         - copied to standard subdir 'cbls' for compile inputs
 :-----cp0    COPYBOOKS - original programs transferred from mainframe
                    - filenames with various extensions & UPPER or lower case
 :-----cpy0   COPYBOOKS - mainframe versions input to standard cleanup/conversion
                    - filenames UPPER case & No extensions
 :-----cpy1         - cleaned up, clear 1-6,73-80, lower case (except quotes)
                    - extensions standardized to '.CPY'
 :-----cpy2         - converted, via search/replace tables
 :-----cpys         - copied to standard subdir 'cpys' for compile inputs
 :-----jc0     JCL  - original programs transferred from mainframe
                    - filenames with various extensions & UPPER or lower case
 :-----jcl0    JCL  - mainframe versions input to standard cleanup/conversion
                    - filenames UPPER case & No extensions
 :-----jcl1         - cleanup, cols 73-80 cleared
                    - extensions standardized to '.jcl'
 :-----jcl2         - PROCs expanded, SLIs included
 :-----jcl3         - converted to Korn shell scripts
                    - extensions standardized to '.ksh'
 :-----jcls         - standard subdir for debug/test

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

6E2. Converting YOUR Mainframe COBOL (vs test/demos)

Standardizing before Conversion

The previous page showed the subdirs required to standardize the libraries of COBOL, Copybooks,& JCL before the documented conversions can be run. In our example the COBOL programs had various extensions as follows:

 *.C   - indicated traditional COBOL text in cols 7-72
 *.CBL - indicated Free-Flow COBOL text in cols 1-255

We decided to use the traditional COBOL format. We can use the 'y6' option of the uvcopy 'cleanup' job to shift the text 6 columns to the right. But first we needed to isolate the .CBL's into a separate directory since we will use the 'uvcopyx' script to run 'cleanup' for all files found in a directory.

Extra subdirs to standardize modules

The standard script to make the subdirs for COBOL, Copybook,& JCL conversions makes cbl0, cpy0, jcl0 & all the other subdirs shown on page '6C2'. Here are the instructions to make the extra subdirs required for standardization & that are shown on the previous page '6E1'.


 #0. mkdir cb0 cb0C cb0CBL cp0 cpc cpcbl jc0
     =======================================

The subdirs for COBOL conversion will then be:

 /home/mvstest
 :-----testlibs
 :     :-----cb0      - original programs transferred from mainframe
                      - filenames with various extensions & UPPER or lower case
 :     :-----cb0C     - *.C extensions copied here
 :     :-----cb0CBL   - *.CBL extensions copied here
 :     :-----cbl0     - mainframe versions input to standard cleanup/conversion
                      - filenames UPPER case & No extensions
 :     :-----cbl1     - cleaned up, clear 1-6,73-80, lower case (except quotes)
                      - extensions standardized to '.cbl'
 :     :-----cbl2     - converted, via cnvMF5 & search/replace tables
 :     :-----cbls     - copied to standard subdir 'cbls' for compile inputs

We will transfer all COBOL programs from the mainframe to the 'cb0' subdir. Then we will copy/shift/rename over to 'cbl0' before we begin the standard COBOL conversions previously used for our test/demo conversions.

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

6E3. Converting YOUR Mainframe COBOL (vs test/demos)

Standardizing COBOL programs

These Op. Instrns. will copy COBOL programs from 'cb0' to 'cbl0' while standardizing filenames to all UPPER case with no extensions. Note that we will later standardize all converted filenames to lower case (IE - UPPER case signifies mainframe versions, lower case signifies converted to unix/linux versions).

We also need to shift any free format programs to the traditional COBOL format (as explained above).


 #1. renameU cb0    <-- ensure mainframe COBOL program filenames UPPER case
     ===========

 #2.  Separate programs to different subdirs for different mass processing.
      Our example is to shift any free flow formats to traditional format.
      (free flow programs have extension .C & traditionals have .CBL)

 #2a. mv cb0/*.C cb0C       <-- isolate traditional format to separate subdir
      ===============

 #2b. mv cb0/*.CBL cb0CBL   <-- isolate free flow format to separate subdir
      ===================
  1. Investigate what is left in subdir 'cb0' ? There may be some other extensions that need to be spot checked with 'vi' & then moved to either 'cb0C' or 'cb0CBL' as appropriate. You might even find some Copybooks or JCL in the wrong library & you should move to wherever they belong. For our example we found some .OLD extensions.


 3a. mkdir cb0OLD           <-- make subdir
     ============
 3b. mv cb0/*.OLD cb0OLD    <-- copy .OLD programs to subdir cb0OLD
     ===================

 #4a. cp cb0C/* cbl0     <-- copy traditional format to the standard lib
      ==============
      - we could have copied directly to cbl0, but we have 1st isolated
        (same as for free-flow) in case you want to do some other
        processing or run validity checks to prove all same format.

 #4b. uvcopyx cleanup cb0CBL cbl0 uop=q0i7y6
      ======================================
      - shift any Free-Flow format to traditional format
      - option 'y6' shifts right 6 columns (leaving cols 1-6 blank)

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

6E4. Converting YOUR Mainframe COBOL (vs test/demos)

Standardizing COBOL programs (cont)

Now we have all COBOL programs in subdir 'cbl0'. Before we begin our standard conversions, we will remove all extensions & check for duplicates (could occur if .C & .CBL programs had same base name).


 #5.  rename-XX cbl0     <-- remove all extensions
      ==============
               - will prompt for overwrite if removing extension causes duplicate
      --> n  <-- reply 'n' to avoid overwriting 1st program of duplicate pair

 #6a. ls -l cbl0                 <-- investigate to see duplicate filenames
      ==========
 #6b. vi cbl0/XXX.cbl            <-- might use vi
      ===============
 #6c. diff cbl0/XXX cbl0/XXX.cbl <-- might use diff to see if same & drop 1
      ==========================

I suggest you use the 'rename-XX2' script to simply append a '2' to the basename & remove the duplicate.


 #7.  rename-XX2 cbl0    <-- replace any .extensions with '2' appended to base
      ===============

 #8.  llm cbl0           <-- investigate again to ensure no extensions left
      ========             - 'llm' is script equivalent of 'ls -l xxx | more'

 #9.  rename-XX3 cbl0    <-- replace any .extensions with '3' appended to base
      ===============
  1. Now ensure all files in cbl0 are legitimate COBOL programs. We might use uvcopy utility job 'count2d' to scan for any files WITHOUT 'PROGRAM-ID'. You can then investigate them & move them out to where they belong (copybooks, JCLs, etc).


 #10a. uvcopy count2d,fild1=cbl0,arg1=program-id=0
       ===========================================
       - scans for files with occurrences of 'PROGRAM-ID' = ZERO

 #10b. uvlp12 tmp/programid    <-- print the report
       ====================

 #11a. vi cbl0/XXXXXX          <-- investigate any non COBOL files
       ==============
 #11b. mv cbl0/XXXXXX cpy0 or jcl0 or ?   <-- move out as appropriate
       ==============================

 #12a. spreadA cbl0         <-- create 4-up list of all programs in cbl0
       ============
 #12b. uvlp12 tmp/cbl0.4up  <-- print the 4-up listing
       ===================

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

6E5. Converting YOUR Mainframe COBOL (vs test/demos)

Standardizing CopyBooks

These Op. Instrns. will copy COBOL CopyBooks from 'cp0' to 'cpy0' while standardizing filenames to all UPPER case with no extensions. Note that we will later standardize all converted filenames to lower case (IE - UPPER case signifies mainframe versions, lower case signifies converted to unix/linux versions).


 #1. renameU cp0    <-- ensure mainframe CopyBook filenames UPPER case
     ===========

 #2.  Separate CopyBooks to different subdirs for different mass processing.
      Our example is to shift any free flow formats to traditional format.
      (free flow copybooks have extension .C & traditionals have .CBL)

 #2a. mv cp0/*.C cp0C       <-- isolate traditional format to separate subdir
      ===============

 #2b. mv cp0/*.CBL cp0CBL   <-- isolate free flow format to separate subdir
      ===================
  1. Investigate what is left in subdir 'cp0' ? There may be some other extensions that need to be spot checked with 'vi' & then moved to either 'cp0C' or 'cp0CBL' as appropriate. In our example we found some '.0' extensions which were traditional layout, so we simply moved them to cp0CBL.


 3a. llm cp0   <-- investigate to see any non-standard .extensions left behind
     =======
 3b. mv cp0/*.0 cp0CBL   <-- move non-standard extensions to appropriate subdir
     =================

 #4a. cp cp0C/* cpy0     <-- copy traditional format to the standard lib
      ==============
      - we could have copied directly to cpy0, but we have 1st isolated
        (same as for free-flow) in case you want to do some other
        processing or run validity checks to prove all same format.

 #4b. uvcopyx cleanup cp0CBL cpy0 uop=q0i7y6
      ======================================
      - shift any Free-Flow format to traditional format
      - option 'y6' shifts right 6 columns (leaving cols 1-6 blank)

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

6E6. Converting YOUR Mainframe COBOL (vs test/demos)


 #5.  rename-XX cpy0     <-- remove all extensions
      ==============
               - will prompt for overwrite if removing extension causes duplicate
      --> n  <-- reply 'n' to avoid overwriting 1st program of duplicate pair

 #6a. ls -l cpy0                 <-- investigate to see duplicate filenames
      ==========
 #6b. vi cpy0/XXX                  - might use vi to check contents
      ===========
 #6c. diff cpy0/XXX cpy0/XXX.XXX <-- might use diff to see if same & drop 1
      ==========================

I suggest you use the 'rename-XX2' script to simply append a '2' to the basename & remove the duplicate.


 #7.  rename-XX2 cpy0    <-- replace any .extensions with '2' appended to base
      ===============

 #12a. spreadA cpy0         <-- create 4-up list of all CopyBooks in cbl0
       ============
 #12b. uvlp12 tmp/cpy0.4up  <-- print the 4-up listing of all CopyBooks
       ===================

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

6E7. Converting YOUR Mainframe COBOL (vs test/demos)

Standardizing JCL

These Op. Instrns. will copy JCL from 'jc0' to 'jcl0' while standardizing filenames to all UPPER case with no extensions. Note that we will later standardize all converted filenames to lower case (IE - UPPER case signifies mainframe versions, lower case signifies converted to unix/linux versions).


 #1. renameU jc0    <-- ensure mainframe JCL filenames UPPER case
     ===========

 #2. cp jc0/* jcl0  <-- copy JCL from jc0 (unzip lib)
     =============      to jcl0 (where standard conversions begin)
     - in this case, we could have transferred/unzipped in jcl0 (vs jc0)
       (since we did not have to shift JCL columns as we did for COBOL)
     - But it is better to provide for sites that might need to shift, etc

 #3.  rename-XX jcl0     <-- remove all extensions
      ==============
               - will prompt for overwrite if removing extension causes duplicate
      --> n  <-- reply 'n' to avoid overwriting 1st program of duplicate pair

 #4a. ls -l jcl0                 <-- investigate to see duplicate filenames
      ==========
 #4b. vi jcl0/XXX                  - might use vi to check contents
      ===========
 #4c. diff jcl0/XXX jcl0/XXX.XXX <-- might use diff to see if same & drop 1
      ==========================

I suggest you use the 'rename-XX2' script to simply append a '2' to the basename & remove the duplicate.


 #5.  rename-XX2 jcl0    <-- replace any .extensions with '2' appended to base
      ===============

You might still get an overwrite prompt on rename-XX2 if there was already a module matching the basename but with last character '2'. For example if 3 original modules were: PAYROLL.JCL, PAYROLL.JOB,& PAYROLL2.JCL. The 'rename-XX' removes the '.JCL's, but '.JOB' is not removed since it would overwrite. The 'rename-XX2' is run to change remaining extensions to '2', but it would get an overwrite prompt since adding a '2' would match existing 'PAYROLL2'. The solution is to do a manual rename (might append a '3').


 #5a. mv jcl0/PAYROLL.JOB jcl0/PAYROLL3
      =================================

 #6a.  spreadA jcl0         <-- create 4-up list of all JCL in cbl0
       ============
 #6b.  uvlp12 tmp/jcl0.4up  <-- print the 4-up listing of all JCL
       ===================

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

6F1. Converting YOUR Mainframe COBOL (vs supplied test/demos)

Directories used in Conversion Procedures

 cpy0 ---------> cpy1 ----------> cpys
       cleanup         convert
 cbl0 ---------> cbl1 ----------> cbl2 ---------> cbls
       cleanup         convert          copy(cp)
 jcl0 ---------> jcl1 ------------> jcl2 ----------> jcl3 ---------------> jcls
       cleanup         proc expand        convert         copy/test/debug
 proc0 --------> procs
       cleanup
 cclib0 -------> cclib1
        cleanup control card modules: sort fields, FTP specs, etc

By convention the mainframe library modules will be transferred to the '0' subdir (cbl0, cpy0, jcl0, proc0, cclib0). The text in these will usually be all UPPER case & the filenames are usually UPPER case as well. I suggest you retain these '0' libraries for up to 1 year in case you need to see the originals before any conversions.

By convention the '1' libraries (cbl1, cpy1, jcl1) hold the cleaned-up libraries. Suffixes '2', '3', '4' indicate temporary intermediate libraries required for conversion & may be dropped after a few months. By convention the 's' library indicates the fully converted libraries. We can illustrate the conversions as follows:

The '1' libraries of COBOL source & copybooks are useful for 'diff's to the converted source. If you want to see what changes the converter made just do a diff between cpy1 & cpys or between cbl1 & cbls. Please see the alldiff cpy1/cpys example on page CNVaids.htm#1G1

'cleanup' - source code maintenance utility

'cleanup' is a uvcopy job to cleanup mainframe library modules prior to conversion for unix/linux. 'cleanup' has many options (see CNVaids.htm#2D1) to accommodate the various library types (COBOL, JCL, control cards, etc).

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

6G1. Converting YOUR Mainframe COBOL (vs supplied test/demos)

convert All COPYBOOKS (vs programs later)

These instructions convert ALL programs in the directory, a multi-step process through several directories:

      cpy0 ---------> cpy1 --------> cpy2 --------> cpys
           cleanup         convert        copy(cp)

 #0. login: yourid --> your home dir

 #1a. cdl --> /p1/testlibs  <-- change to libs superdir (using alias 'cdl')
                              - cdl='cd $RUNLIBS' & export RUNLIBS=/p1/testlibs
 #1b. cdl --> /p2/prodlibs  <-- for production (export RUNLIBS=/p2/prodlibs)

 #2a. cp /home/uvadm/mvstest/cpy0/UNIXWORK1 cpy0
      ==========================================
      - copy supplied copybooks from uvadm to your cpy0 subdir
      - see notes below

 #2b. cp /home/uvadm/mvstest/cpy0/UNIXWORK1 cpy0
      ==========================================

 #3. uvcopyx cleanup cpy0 cpy1 uop=q0i7c5e15g8j1k1l1n1s8t1,arg1=.cpy
     ===============================================================
     - cleanup cobol COPYBOOKS from mainframe
     - remove CR's, clear cols 1-6 & 73-80, translate to lower (not in quotes)
     - shorten text back to last non-blank, ensure output filenames in lowercase
     - cpy0 filenames UPPER case, subsequent subdir filenames must be lowercase

 #4. uvcopy cnvMF5,fild1=cpy1,fild2=cpy2,fili3=ctl/cnvcob5.tbl,uop=q0i7m2
     ====================================================================
     - convert MVS COBOL programs for Unix/Linux/SFU Micro Focus compiler
Note
  • option 'm2' for 'copybook' conversions (vs 'm1' for programs)
  • option 'q0' inhibits the options display & prompt for overrides
  • see all options displayed on page '6G3' (for program conversions)

Notes re UNIXWORK1 & UNIXPROC1

The COBOL converter inserts a 'copy' statement for 'unixwork1.cpy' at WORKING-STORAGE, a 'copy' for 'unixproc1.cpy' at the end of the program, and a 'perform unixproc1' at PROCEDURE DIVISION.

Please see listings & explanations begining on page '2E1'

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

6G2. Converting YOUR Mainframe COBOL (vs supplied test/demos)

Convert ALL cobol PROGRAMS (vs copybooks)

These instructions convert ALL programs in the directory, a multi-step process through several directories:

 cbl0------->cbl1-------->xref---------->cbl2-***---------->cbls-------->cblx
  #1.cleanup  #2.Id OLS files  #4.convert     #5/6  #7.copy     #8.compile

'***' represents optional conversions for sysin & sysout (see Notes below)

step#1 - cleanup code


 #1. uvcopyx cleanup cbl0 cbl1 uop=q0i7c5e15g8j1k1l4n1s8t1,arg1=.cbl
     ===============================================================
     - cleanup mainframe code, remove CRs, clear cols 1-6 & 73-80, etc

step 2&3 - Identify Org Line Seqntl files

The COBOL converter (cnvMF5) provides option 'k_' to lookup an indexed file to identify printer files as 'ORGANIZATION LINE SEQUENTIAL' on 'select' stmnts. Option 'k4' codes files as 'OLS' if cobfil55 coded L/46 in xref/cobfil55I (because it found 'advancing' on writes to that file).

Option 'k2' codes OLS on Input files with recsize 80 & option 'k1' codes OLS on Output files with recsize 132/133.

To use option 'k_', we must 1st run 'uvcopy cobfil55' to create the indexed file xref/cobfil55I, by scanning all COBOL programs,& extracting file info. 'uvsort' is then used to sort & load these records into the indexed file for lookup by the COBOL converter (see 'uvcopy cnvMF5' on the next page).


 #2. uvcopy cobfil55,fild1=cbl1,filo2=xref/cobfil55a,uop=q0i7,rop=r0
     ===============================================================
     - scan all programs looking for 'write advancing's
     - create sequential file of file types keyed by program + filename

 #2a. uvcopy cobfil55   <-- same as above (files default as shown)
      ===============

 #3. uvsort "fili1=xref/cobfil55a,rcs=100,typ=LST,filo1=xref/cobfil55I,typ=ISF\
             ,key1=0(44),isk1=0(44),del1=0(1):*"
     ==========================================================================
     - sort & load sequential file into indexed file for lookup by cnvMF5

 #3a. uvsortload55I   <-- script to perform same as above (but easier)
      =============

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

6G3. Converting YOUR Mainframe COBOL (vs supplied test/demos)

step #4 converting PROGRAMS to Micro Focus COBOL


 #4a. uvcopy cnvMF5,fild1=cbl1,fild2=cbl2,fili3=ctl/cnvcob5.tbl\
     ===========================================================
             ,fili4=xref/cobfil55I     (omit ',uop=q0i7')
             =====================

 #4b. uvcopy cnvMF5   <-- same but easier (directories & files default as above)
      =============     - options default as shown on uop=... below
                        - we recommend adding option 'k7' at prompt below
                        - omit options 'q0i7' to see following display/prompt

options display/prompt caused by option 'q1'

 uop=a0b0c8d1e0j0l0k4m0p0s3u3w1x0y1 - option defaults
     a0               - process all programs in directory
     a1               - process 1 program, spcfd on arg1 on command line
     a2               - process program names solicited until null reply
       b1             - drop blank lines
         c1           - translate copy-book-names to lower case
         c2           - translate copy-book-names to UPPER case
         c0           - do not change copybooks (already done by cleanup)
         c4           - convert "copy ..." to "exec sql include ... end-exec"
                           ** cnvMF5/cnvAIXcbl3 conflict to be resolved **
         c4           - shift 01s col 12+ back to col 8 (in cleanup)
         c8           - shift any CBL options in 1-6 to col 8+
           d1         - replace PERFORMs in DECLARATIVES w performed code
             e1       - convert ACCEPT DATE to env-var SYSDATE
               j0     - inhibit $JOBID insert
               j1     - insert $JOBID prior to display upon console msgs
                 l0   - do not insert ORG Line/Record Seqntl via keywords
                 l1   - insert OLS if matching cardfile keywords
                 l2   - insert OLS if matching printerfile keywords
                 l8   - force all sequential files to ORG Line Seqntl
                   k0 - do not lookup cobfil55aI indexed file to test OLS
                   k1 - set OLS if cobfil55aI recsize 80 (card files?)
                   k2 - set OLS if cobfil55aI recsize 132/133 (printer?)
                   k4 - set OLS if cobfil55aI ID L(46) set by advancing
                     m1 - insert unixwork1/unixproc1 in program
                     m2 - module type = copybook (no unixwork1/unixproc1)
                 p1   - insert missing periods in data-div & working-store
                 p2   - insert missing periods in procedure-division
               s1     - convert sql include filename to "filename.cpy"
               s2     - insert BEGIN/END DECLARE SECTION around host variable copybooks
             u1       - convert literals with nulls to hexadecimal
             u2       - convert literal with any unprintables to hexadecimal
           w1         - gen move parm lth/data unixwork3 to LINKAGE section
         x1           - inhibit inserting EXTERNAL on SELECT stmnts
       y1             - clear cols 1-6 (default), also see cleanup optn s8
       y0             - retain cols 1-6 (do NOT clear)
       y2             - do NOT translate cols 1-6 to lower
 User OPtion (uop) defaults  = q1a0b0c8d1e0j0l0k4m0p0s3u3w1x0y1
 -->null to accept or enter/override -->

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

6G4. Converting YOUR Mainframe COBOL (vs supplied test/demos)

coding ORG LINE SEQ via cobfil55I

Step #2 on the previous page generated xref/cobfil55a, which is loaded into an indexed file for lookup by the COBOL converter to determine Organization Line Sequential for printer output & card input files.

sample cobfil55a - generated from cbl1/...

 *cobfil55  COBOL File Info  Dir=cbl1   2007/08/29_12:09:43
 *progname.cbl FDname                        OAL open recsz copybook.cpy DDname
 *         1         2         3         4         5         6         7
 *1234567890123456789012345678901234567890123456789012345678901234567890123456789
 *===============================================================================
 avf51900.cbl  input-file                    SS  I       80              avf519in
 avf51900.cbl  output-file                       O       86              avf519ot
 avf51900.cbl  log-file                          O       80              avf519lg
 avf52200.cbl  parm-file                         I       72              avf522in
 avf52200.cbl  output-file                       O       25              avf522ot
 callproc.cbl  repout                          L O      120              sysprint
 csm39800.cbl  header-file                       I       40 nasc125a.cpy ihdrfile
 csm39800.cbl  inv-report-file                   O      132              orptfile
 dbasrb09.cbl  i-infile                      SS  I      132              infile
 dbatest9.cbl  date-file                         I       80              parmin
 dbatest9.cbl  report-file                     L O      120              dciout
 nas10800.cbl  master-file                       I       80              master
 nas10800.cbl  hrchy-file                        O      120              hrchy
 nas34000.cbl  nasc040-out-file              IS  O          nasc040.cpy  nasc040o
 nas34000.cbl  nasc041-out-file              IS  O          nasc041.cpy  nasc041o
Note
  • bytes 44-46 (OAL) coded as follows:
 byte 44 Organization
         S - Sequential
         I - Indexed
       blank - most blank, mainframe programs omitted Org, default Seqntl
 byte 45 Access
         D - Dynamic
         S - Sequential
       blank - most blank, mainframe programs omitted Access, default Seqntl
byte 46 L
  • cobfil55 coded 'L' if write advancing found for this file

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

6G5. Converting YOUR Mainframe COBOL (vs supplied test/demos)

coding more files as ORG LINE SEQNTL

When you convert to unix/linux, all Output printer files must be changed to Organization Line Sequential (OLS) before they can be printed with normal unix software (lp scheduler, etc).

It may be advantageous to change Input card/parm/date/etc files to OLS, so you can edit & print them with normal unix/linux software (vi,lp,etc).

We will show you how to use xref/cobfil55I to automatically code most of these files as OLS. This will not be perfect, but you can improve it by manually editing xref/cobfil55a, reloading xref/cobfil55I,& rerunning the COBOL conversion.

After the 1st conversion (#4 on page '6G3'), we can recreate xref/cobfil55a using the converter output subdir cbl2/... (vs cbl1/... used on 1st convert).

sample cobfil55a - generated from cbl2/...

 *cobfil55  COBOL File Info  Dir=cbl2   2007/08/29_12:11:14
 *progname.cbl FDname                        OAL open recsz copybook.cpy DDname
 *         1         2         3         4         5         6         7
 *1234567890123456789012345678901234567890123456789012345678901234567890123456789
 *===============================================================================
 avf51900.cbl  input-file                    L   I       80              avf519in
 avf51900.cbl  output-file                   R   O       86              avf519ot
 avf51900.cbl  log-file                      R   O       80              avf519lg
 avf52200.cbl  parm-file                     L   I       72              avf522in
 avf52200.cbl  output-file                   R   O       25              avf522ot
 callproc.cbl  repout                        L L O      120              sysprint
 csm39800.cbl  header-file                   R   I       40 nasc125a.cpy ihdrfile
 csm39800.cbl  inv-report-file               L   O      132              orptfile
 dbasrb09.cbl  i-infile                      RS  I      132              infile
 dbatest9.cbl  date-file                     L   I       80              parmin
 dbatest9.cbl  report-file                   L L O      120              dciout
 nas10800.cbl  master-file                   L   I       80              master
 nas10800.cbl  hrchy-file                    R   O      120              hrchy
 nas34000.cbl  nasc040-out-file              IS  O          nasc040.cpy  nasc040o
 nas34000.cbl  nasc041-out-file              IS  O          nasc041.cpy  nasc041o

Compare this file created from COBOL converter output cbl2/... vs the prior page report created from cbl1/... (before mainframe to unix convert).

The mainframe programs often omitted 'ORGANIZATION' (defaulted to Sequential), but the converter always inserts 'Record sequential' or 'Line sequential'.

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

6G6. Converting YOUR Mainframe COBOL (vs supplied test/demos)

Options controlling Line Sequential

Page '6G3' shows the options displayed when you run the COBOL converter (without inhibiting the display via option 'i7'). Here we will repeat & expand on options 'l' & 'k' which control coding Org Line Seqntl.

l0
  • do not insert ORG Line/Record Seqntl on selects
l1
  • insert OLS on selects matching cardfile keywords
    (card,date,parm,sysin,sys011)
l2
  • insert OLS on selects matching printerfile keywords
    (print,prnt,report,rept,rpt,list,1403,sys010)
l8
  • force all sequential files to ORG Line Seqntl
k_
  • lookup cobfil55I indexed file to test ORG Line Seq
    and if matching entry found (using FDname as indexed key)
k1
  • set OLS if Input file & recsize = 80 (card files)
k2
  • set OLS if Output file & recsize = 132/133 (printer files)
k4
  • set OLS if cobfil55I matching entry has 'L' in byte 46
    (set if 'write advancing' found for matching file)

Plan to modify Org Line Seqntl coding

  1. edit xref/cobfil55a (generated from cbl2/...) adding 'L' in byte 44 for files you desire to be OLS & removing 'L' in 44 for files you do not want to be Organization Line Sequential.

  2. Reload the Indexed file used by the COBOL converter (xref/cobfil55I) from the edited text file (xref/cobfil55a).

  3. Rerun the COBOL converter (cnvMF5) specifying options 'l0' & 'k4'. 'l0' inhibits using keywords in filenames to determine OLS. 'k4' tests the matching entry in xref/cobfil55I only for 'L' in 44 or 46 to add 'Line sequential'.

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

6G7. Converting YOUR Mainframe COBOL (vs supplied test/demos)

Op. Instrns. to modify Org Line Seqntl coding

The following instructions would follow the 1st COBOL conversion performed previously on page '6G3'.


 #5. uvcopy cobfil55,fild1=cbl2,filo2=xref/cobfil55a,uop=q0i7,rop=r0
     ===============================================================
     - scan all programs looking for 'write advancing's
     - create sequential file of file types keyed by program + filename

 #5a. uvcopy cobfil55,fild1=cbl2  <-- must specify 'cbl2' (other dflts OK)
      ==========================

 #6. vi xref/cobfil55a    <-- edit the OLS control file
     =================      - see some discussion on next page --->

 #7. cp xref/cobfil55a xref/cobfil55a_edited
     =======================================
     - be sure to save your edited file
       (in case cobfil55 rerun which would overwrite your edited version)

 #8. uvsort "fili1=xref/cobfil55a,rcs=100,typ=LST,filo1=xref/cobfil55I,typ=ISF\
             ,key1=0(44),isk1=0(44),del1=0(1):*"
     ==========================================================================
     - sort & load sequential file into indexed file for lookup by cnvMF5

 #8a. uvsortload55I   <-- script to perform same as above (but easier)
      =============

 #9. uvcopy cnvMF5,fild1=cbl1,fild2=cbl2,fili3=ctl/cnvcob5.tbl\
     ===========================================================
             ,fili4=xref/cobfil55I,uop=l0k4   <-- options 'l0k4' critical
             ==============================

 #4b. uvcopy cnvMF5,uop=l0k4   <-- same but easier, specify options only
      ======================     - directories & files default as above

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

6G8. Converting YOUR Mainframe COBOL (vs supplied test/demos)

notes re: editing xref/cobfil55a

Here are a few notes to help you understand the coding in xref/cobfil55a and how you might change to improve assignment of ORG LINE SEQNTL on desired files.

We will show some of the files from page '6G5' for discussion. You may compare these codes generated from cbl2/... after 1st conversion, to the original codes generated from cbl1/... (before conversion).

 *cobfil55  COBOL File Info  Dir=cbl2   2007/08/29_12:11:14
 *progname.cbl FDname                        OAL open recsz copybook.cpy DDname
 *         1         2         3         4         5         6         7
 *123456789012345678901234567890123456789012345678901234567890
 *===========================================================
 avf51900.cbl  input-file                    LS  I       80      <-- note #01
 avf51900.cbl  output-file                   R   O       86      <-- note #02
 avf51900.cbl  log-file                      R   O       80
 avf52200.cbl  parm-file                     L   I       72      <-- note #04
 avf52200.cbl  output-file                   R   O       25
 callproc.cbl  repout                        L L O      120      <-- note #06
 csm39800.cbl  header-file                   R   I       40      <-- note #07
 csm39800.cbl  inv-report-file               L   O      132
 dbasrb09.cbl  i-infile                      RS  I      132
 dbatest9.cbl  date-file                     L   I       80
 dbatest9.cbl  report-file                   L L O      120
 nas10800.cbl  master-file                   L   I       80      <-- note #12
 nas10800.cbl  hrchy-file                    R   O      120      <-- note #13

 #01 - coded L/44 due to option k1 & Input recsize = 80

 #02 - coded R/44 since converter defaults to 'Record Seqntl', unless it finds
       a reason to code as 'Line Seqntl'

 #04 - coded L/44 due to option l1 & keyword 'parm' found in filename

 #06 - coded L/44 due to option k4 which causes cobfil55 to inserted L/46
       if it finds 'write advancing' for this filename.

 #07 - coded R/44 since no keyword match & Input recsize not 80.
Note
  • filename 'header-file' might indicate that this is a control file
  • which would be more convenient if it were a text file
  • if so, you could change R/44 to L/44 before the 2nd conversion

 #12 - coded L/44 due to option l1 & Input recsize 80.
Note
  • this is probably wrong since filename 'master-file'
  • you probably need to change L/44 to R/44 before 2nd convert

 #13 - coded R/44 since no matching keywords & recsize not 132/133
       & no 'write advancing' found for this file.

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

6G9. Converting YOUR Mainframe COBOL (vs supplied test/demos)

step 5&6 - optional replacements for SYSIN & SYSOUT

MicroFocus COBOL has options INDD & OUTDD to cause 'ACCEPTs from SYSIN' & 'DISPLAYs upon SYSOUT' to use external files defined by exports for SYSIN & SYSOUT. Please see the options file ctl/cobdirectives on page '5D1' & a test/demo program & JCL begining on page '2F1'.

For customers that do not have MicroFocus COBOL, the Vancouver Utilities includes uvcopy utility jobs 'sysin1' & 'sysout1' which will insert file definitions into the COBOL source programs.

sysin1 will convert 'accepts from sysin' to 'reads' from a real file with external name SYSIN. sysout1 will convert 'displays upon sysout' to 'writes' to a real file with external name SYSOUT.

optional sysin1 & sysout1


 #5.  uvcopyx sysin1 cbl2 cbl3 uop=q0i7    <-- optional, see NOTE below
      =================================
            - convert ACCEPT's from control streams to READ's from a file

 #6.  uvcopyx sysout1 cbl3 cbl4 uop=q0i7   <-- optional, see NOTE below
      ==================================
            - convert DISPLAY's upon SYSOUT to WRITE's to a file

Optional steps #5 & #6 are not required for Micro Focus COBOL using options INDD & OUTDD. See the 'cobdirectives' file listed on page '5D1'.

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

6G10. Converting YOUR Mainframe COBOL (vs supplied test/demos)

copy & compile


 #7. copy converted programs to subdir 'cbls' for compile script (mfcblA).

 #7a. cp cbl2/* cbls  - copy from cbl2 if SYSIN/SYSOUT replacements NOT required
      ==============
 #7b. cp cbl3/* cbls  - copy from cbl3 if SYSIN required but not SYSOUT
      ==============
 #7c. cp cbl4/* cbls  - copy from cbl4 if both SYSIN/SYSOUT replacements required
      ==============

 #8. mfcblA all      - compile all programs for unix/linux
     ==========        (input source from cbls & output .int/.idy to cblx)

why copy cbl2/3/4/* to cbls ?

The 'extra' directory is used in case you rerun the conversion of all programs in directory, after you have already debugged some of the programs in cbls. Mass reconversion replaces all programs in 'cbl2/3/4', but never in 'cbls' where you may have invested many hours of edit/test/debug. After mass reconversion you can selectively copy desired programs from cbl2/3/4 to cbls.

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

6H1. Converting YOUR Mainframe COBOL (vs supplied test/demos)

Op Instrns - compiling cobol Programs - 1 or ALL

Scripts are provided to compile COBOL programs, either 1 at a time, or all in the directory. The 'ALL in directory' script will save a lot of time, but before you attempt that, you should first compile a few programs individually to see if the error rate is low enough to warrant compiling all.

If almost all programs are failing, there may be a few common causes, which once corrected will cause most programs to compile clean. You may be able to correct the common causes by modifying the conversion search/replace table.

When you have corrected the common causes, then perform the mass compile & print out the error reports (as explained on page '6H2') for analysis. You may find more common failures that can be corrected by more changes to the search/replace tables.

When you have optimized the search/replace table you can recompile all, reprint the errors,& only then begin the manual editing to correct the various problems in individual programs. Note that the error reports make it easy to assign the corrections to various team members.

script to compile 1 program at a time


 mfcbl1 program.name  <-- compile command format (for Unix/Linux)
 ===================

 mfcbl1 car100.cbl     <-- example
 =================

 mfnxcbl1 car100.cbl   <-- compile command for Net Express on Windows/SFU
 ===================

We are using program 'car100.cbl' as an example. This is 1 of the test programs used by JCLcnv1demo.htm#2A1 to illustrate the conversion of COBOL & JCL, and then the execution of the JCL/scripts & programs. The default sub-directories are as follows:

cbls
  • fully converted batch COBOL program source
cpys
  • copybooks
cblx
  • compiled programs: .int, .idy, .cbl, .err
  • several modules for each program
  • examples below for program 'car100'

To compile ALL programs in the directory, see 'mfcblA' on the next page --->

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

6H2. Converting YOUR Mainframe COBOL (vs supplied test/demos)

Op Instrns - compiling All Programs in directory

In addition to compiling all programs in the directory, the following instructions show you how to capture the error reports & mass print for easier analysis & correction (max 1 page per program).


 #1a. login: yourid --> your home dir

 #1b. cdl --> /u1/apps/testlibs/aaco/apay    <-- alias cdl='cd $RUNLIBS'

 #2. mfcblA all [ cbls cblx cpys ]
     =============================
            - compile all programs from cbls into cblx (for Unix/Linux)
              (cblx also receives .err files for programs with errors)
Note
  • you do not have to specify arg2,3,4 if the defaults above are correct
  • alternate scripts are provided for Unix/Linux & SFU/UWIN/CYGWIN/Windows

 #2a. mfcblA all     - for Unix/Linux, compiles to .ints/.idys for animation
      ==========
        -OR-
 #2b. mfnxcblA all   - for SFU/UWIN/CYGWIN/Windows, compile to .int/.idy
      ============
        -OR-
 #2c. mfnxcblB all   - for SFU/UWIN/CYGWIN/Windows, compile to .exe's
      ============

See scripts mfcbl1, mfcblA, etc in /home/uvadm/sf/IBM. Also see the options file /home/uvadm/ctl/cobdirectives which is specified within the scripts.

printing compile ERROR reports to guide corrections

The 'mfcbl1' & 'mfcblA' compile scripts leave the .err reports in the 'cblx' output directory. You can use the 'uvlpd1p' script to print the first page of each .err file in the cblx subdir as follows:


 #3.  uvlpd1p cblx .err      <-- print 1st page for all .err files
      =================

See sample error report on the next page ---->

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

6H3. Converting YOUR Mainframe COBOL (vs supplied test/demos)

Here is a sample 'cobol compile failure report' created by the compile scripts mfcblA &/or mfcbl1, documented on the previous page.

COBOL compile ERROR reports - sample

 #compile#0248: cmb0302m.cbl -     4014 lines
   2944     string in-fund-cd-last-3,
 *  12-S****************************                                    (   0)**
 **    Operand IN-FUND-CD-LAST-3 is not declared
   3131     string in-fund-cd-last-3,
 *  12-S****************************                                    (  51)**
 **    Operand IN-FUND-CD-LAST-3 is not declared
   3307     string in-fund-cd-last-3,
 *  12-S****************************                                    (  55)**
 **    Operand IN-FUND-CD-LAST-3 is not declared
   3528     string in-fund-cd-last-3,
 *  12-S****************************                                    (  58)**
 **    Operand IN-FUND-CD-LAST-3 is not declared
   3630     string in-fund-cd-last-3,
 *  12-S****************************                                    (  61)**
 **    Operand IN-FUND-CD-LAST-3 is not declared
   3709     string in-fund-cd-last-3,
 *  12-S****************************                                    (  63)**
 **    Operand IN-FUND-CD-LAST-3 is not declared
   3794     string in-fund-cd-last-3,
 *  12-S****************************                                    (  65)**
 **    Operand IN-FUND-CD-LAST-3 is not declared
 cob32: error(s) in compilation: cmb0302m.cbl

You could print 1 or all error reports as follows:


 uvlp12 cblx/cmb0302m.err e1 <-- print 1 specified error report
 ===========================   - option e1 ends after 1 page

 uvlpd1p cblx .err           <-- print all error reports
 =================               (1st page only)

The 'uvlpd1p' script prints only the 1st page of each report. You usually only need the 1st page (or only the 1st few lines) since often the first error causes many other errors.

But if you have a lot of errors, there is an better solution on the next page. uvcopy jobs cblerrs1 & cblerrs2 will extract only the 1st 5 lines of each error report & format them 8 per page, sorted by compile failure reason.

The 1st 5 lines is enough to see the 1st error & usually the 1st error causes the following errors, so it is most efficient to fix the 1st error in all programs & then do another mass compile & another mass .err listing, etc.

This is a great help for the initial conversions & mass compiles when there may be hundreds of errors due to differences between the mainframe compiler and the unix compiler (Micro Focus recommended).

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

6H4. Converting YOUR Mainframe COBOL (vs supplied test/demos)

Compile Error Summaries - cblerrs1/cblerrs2

There could be a lot of errors on the 1st mass compile after conversion. 'cblerrs1' & 'cblerrs2' are provided to extract only the 1st few lines from each .err file into 1 file & to create table summary counts of errors by failure reason.


 #1.  uvcopy cblerrs1[,fild1=cblx,filo1=errs/cblerrs1.rpt]
      ====================================================
      - extract 5 lines of each .err file to summary file errs/cblerrs1.rpt

 #1a. uvcopy cblerrs1  <-- Easier Alternative (files default as shown above)
      ===============

 #2.  uvcopy cblerrs2[,fili1=errs/cblerrs1.rpt,filo1=errs/cblerrs2.rpt\
                      ,filo2=errs/cblerrs2a.tbl,filo3=errs/cblerrs2b.tbl]
      ===================================================================
      - sort by failure reason & create summary tables

 #2a. uvcopy cblerrs2  <-- Easier Alternative (files default as shown above)
      ===============

 #3a. uvlp12 errs/cblerrs2a.tbl <-- print table summary counts by failure reason
      =========================   - summary by MAJOR reason for failure
                                    (ex: copybooks not found 1 line vs multiple)

 #3b. uvlp12 errs/cblerrs2b.tbl <-- print table summary counts by failure reason
      =========================   - DETAIL for each failure reason
                                    (shows al copybooks missing re sum count)

 #3c. uvlp12 errs/cblerrs2.rpt  <-- print detail report sorted by failure reason
      ========================

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

6H5. Converting Mainframe COBOL to Micro Focus

Here are sample reports created by the jobs documented above:


 #1a. uvcopy cblerrs1   <-- generate failure reports (unsorted)
 #2b. uvcopy cblerrs2   <-- generate failure reports (sorted) + summary tables

 #3a. uvlp12 errs/cblerrs2a.tbl <-- print summary by failure Major-Reason
      =========================

compile failure MAJOR-REASON summary table

 cblerrs2 2010/01/12 compile fail major reason summary table errs/cblerrs2a.tbl
 tbl#001 pg#001     -argument-
 line#  count    %  compile fail major reason
    1        1   2  **
    2        1   2  ** Boundary violation. Process
    3        1   2  ** Character other than *, D,
    4        3   7  ** Continuation character expe
    5        2   5  ** DEPENDING missing
    6        1   2  ** Data item too long
    7        1   2  ** Invalid operand
    8        2   5  ** Literal is numeric - treate
    9        1   2  ** Numeric literal expected
   10        2   5  ** PROCEDURE DIVISION missing
   11        5  12  ** Period missing. Period assu
   12       12  30  ** Unknown COPY file             <-- see DETAIL below
   13        1   2  ** Unrecognized phrase in SELE
   14        2   5  ** Unsigned numeric field. Sig
   15        4  10  ** User-name not unique
            39*100   *TOTAL*

 #3b. uvlp12 errs/cblerrs2a.tbl <-- print summary by failure Detail-Reason
      =========================

compile failure DETAIL-REASON summary table

   12        5  12  ** Unknown COPY file          e212015b.cpy
   13        2   5  ** Unknown COPY file          e212057b.cpy
   14        1   2  ** Unknown COPY file          e212085b.cpy
   15        2   5  ** Unknown COPY file          e212137b.cpy
   16        1   2  ** Unknown COPY file          e212817b.cpy
   17        1   2  ** Unknown COPY file          e231013b.cpy

Note that for the DETAIL-REASON report, we are showing only the difference. All failures due to 'Unknown COPY book' are summarized on 1 line in the Major-Reason report, but expanded to show the missing copybook name in the Detail-Reason report.

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

6H6. Converting Mainframe COBOL to Micro Focus

program failure report - sorted by reason

Use this report 'errs/cblerrs2.rpt' as your guide to corect program errors.

'errs/cblerrs2.rpt' includes 5 lines for each compile failure, showing you the program name & the 1st error in the program. The 1st error often causes all remaining errors, so I recommend you fix only the 1st error & recompile to get a new failure report.


 #3c. uvlp12 errs/cblerrs2.rpt <-- print program report sorted by failure reason
      ========================
 #Compile#=0093 Program=e212233c.cbl Lines=3371 TotalSeq#=2 FailReasonSeq#=1
   5442     move t-gl (8) to ib-200-1-cd-gl.
 ** Boundary violation. Processed as written.
 cob32: error(s) in compilation: e212233c.cbl
 ~~
 #Compile#=0146 Program=e212520c.cbl Lines=8749 TotalSeq#=3 FailReasonSeq#=1
   68275    move mp-f062-0-clas-ind-ap to work-clas-ind.
 ** Character other than *, D, /, -, or $ found in column 7. Blank assumed.
 *1001-E                                                                (   0)**
 ~~
 #Compile#=0199 Program=e212648c.cbl Lines=3267 TotalSeq#=4 FailReasonSeq#=1
   4511            display "RECORD 1 ABSENT AU F-CREDIT-TAXES E212945
 ** Continuation character expected. End of literal assumed.
 cob32: error(s) in compilation: e212648c.cbl
 ~~
 #Compile#=0207 Program=e212661c.cbl Lines=7264 TotalSeq#=5 FailReasonSeq#=2
   5907               display "RECORD 1 ABSENT AU F-CREDIT-TAXES E212945
 ** Continuation character expected. End of literal assumed.
 cob32: error(s) in compilation: e212661c.cbl
 ~~
 #Compile#=0290 Program=e212840c.cbl Lines=1313 TotalSeq#=6 FailReasonSeq#=3
   2961                      " MP-F075-0-MAT2-K " "
 ** Continuation character expected. End of literal assumed.
 cob32: error(s) in compilation: e212840c.cbl
 ~~
 #Compile#=0277 Program=e212815c.cbl Lines=3648 TotalSeq#=7 FailReasonSeq#=1
   1922                    indexed by idx-i-ni.
 ** DEPENDING missing
 ~~
 #Compile#=0286 Program=e212827c.cbl Lines=3308 TotalSeq#=8 FailReasonSeq#=2
   1809                                          indexed by idx-i-ni.
 ** DEPENDING missing
 ~~
                    - - - about 200 lines omitted - - -
Note
  • report above sorted by failure reason, with blank lines between groups
  • option to stop print for reason groups (default 30)
  • fix high volume failure reasons first
    (perhaps by modifying search/replace table ctl/cnvcob5.tbl)

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

6I1. Converting YOUR Mainframe COBOL (vs supplied test/demos)

compile failure reason table summaries

The table summary analysis is particularly useful for the initial conversion and mass compile, because there may be hundreds of compile failures due to compiler differences. Often the older mainframe programs assigned field names that conflict with 'reserved words' in newer cobol compilers.

The summary analysis by failure reason allows you to investigate the reasons that are creating the most errors & fix them by modifying the search/replace tables of if necessary asking UV Software to modify the COBOL converter.

After changing the search/replace tables & the cobol converter to fix higher volume failure reasons, you would repeat the mass conversion & mass compile. Then rerun cblerrs1, cblerrs2,& reprint cblerrs2.rpt & cblerrs2.tbl

You will soon get the failure rate low enough so that the remaining errors can be fixed manually. They are usually odd coding that the mainframe coding allowed, but the Micro Focus cobol compiler does not.

Investigate errors, correct, & re-compile

The .err reports make it easy to investigate & correct the programs. You write the corrections required on the bottom of each .err report. If desired, you split up the .err reports & assign to other programmers.

There probably will be many errors the first time you mass compile a new system. It is much more efficient to correct as many as you can, before recompiling all & reprinting the .err reports, until you get the errors down to a few programs.

Most corrections will probably be made by adding entries to the search/replace tables (cnvcob5.tbl for MVS). See cnvcob5.tbl listed on page '5B2'.

Important Notes

  1. Try to get the automatic mass conversion as good as possible by modifying the search/replace table & repeating the mass conversion & compiles until you get an acceptable error rate (for manual corrections). You might also request UV Software to modify the converter if you see some additional conversions that would be helpfull at your site.

  2. Keep track of any programs changed on Mainframe during the testing period, so we will only have to reconvert the changed programs.

  3. If changes on Mainframe are minor, you may not have to reconvert, just make the same changes directly to the 'cbls' converted library.

  4. For major changes or new programs, you could convert them individually (with cnvMF51) so as not to overwrite your proven & tested programs.

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

6J1. Converting YOUR Mainframe COBOL (vs supplied test/demos)

search/replace tables to improve conversion

'cnvMF5' is the uvcopy job that performs COBOL conversions for MVS COBOL.

In addition to the COBOL program, these jobs expects to input a search/replace table that you can customize to improve the COBOL conversion. The table is used primarily to resolve reserved word conflicts (fieldnames in the mainframe program that are considered 'reserved words' by unix/linux Micro Focus COBOL).

I suggest you perform a trial mass conversion of all programs & examine the errors to see if you can eliminate common recurring errors by adjusting the search/replace table. The 'all programs in directory' conversion methods save the .err files in the cblx output directory. A script is provided to print out the 1st page of each .err report to assist you in analysis and improvement of the search/replace table.

search/replace table for conversion

For the 1st trial conversion, you can copy the supplied table from 'uvadm' to your conversion libraries, for example:


 cp /home/uvadm/ctl/cnvcob5.tbl ctl     <-- for MVS
 ==================================

These are search/replace conversion tables (see cnvcob5.tbl listing next page). Most entries are used to modify the spellings of RESERVED words for MF COBOL that were not reserved words for mainframe COBOL. Here are 3 sample entries.

  next-page;~~~~~~~~~~~~~~~~~~~ page;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  upon conslog;~~~~~~~~~~~~~~~~ upon console;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  name;~~~~~~~~~~~~~~~~~~~~~~~~ name1;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

You will add entries to the table to solve problems discovered by compiling. You will then need to reconvert perhaps both copybooks & programs before recompiling.

COBOL compile options file

Options for unix/linux Server Express & Windows Net express may be defined in control files. Samples are supplied in /home/uvadm/ctl/cobdirectives & in /home/uvadm/ctl/cobol.dir. These are listed on pages '5D1' & '9B1'.

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

6J2. Converting YOUR Mainframe COBOL (vs supplied test/demos)

cnvcob5.tbl - conversion table

 # ctl/cnvcob5.tbl - search/replace table for cobol convert job (cnvMF5)
 #                 - see complete detail in part 3 of MVSCOBOL.doc
 # - modify or add to this table depending on site requirements
 # - to change words that are now reserved in Unix/Linux Micro Focus compiler
 # - trailing ';' in search pattern matches a blank,period,comma,or semicolon
 # - these reserved word replacements were developed at Unisys OS3 sites
 # - where search words (left side) were user fieldnames (not reserved on OS3)
 # - might have to remove some for IBM sites where intended as reserved ??
 # 01-30 - search pattern (ended by 1st tilde)
 # 31-60 - replacement pattern (ended by 1st tilde)
 # 61-80 - optional qualifier (61 '=' present, '!' not present, '~' not used)
 #       - qualifier optional, if present it must be on same line as search
 #
  examine ~~~~~~~~~~~~~~~~~~~~~ inspect ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  transform ~~~~~~~~~~~~~~~~~~~ inspect ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  kanal1;~~~~~~~~~~~~~~~~~~~~~~ page;~~~~~~~~~~~~~~~~~~~~~~~~= advancing ~~~~~~~~
  new-page;~~~~~~~~~~~~~~~~~~~~ page;~~~~~~~~~~~~~~~~~~~~~~~~= advancing ~~~~~~~~
  top-of-page;~~~~~~~~~~~~~~~~~ page;~~~~~~~~~~~~~~~~~~~~~~~~= advancing ~~~~~~~~
  top-of-form;~~~~~~~~~~~~~~~~~ page;~~~~~~~~~~~~~~~~~~~~~~~~= advancing ~~~~~~~~
  id division;~~~~~~~~~~~~~~~~~ identification division;~~~~~~~~~~~~~~~~~~~~~~~~~
  file-id;~~~~~~~~~~~~~~~~~~~~~ file-id1;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 left-justify;~~~~~~~~~~~~~~~~~left-justify1;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 right-justify;~~~~~~~~~~~~~~~~right-justify1;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  name;~~~~~~~~~~~~~~~~~~~~~~~~ name1;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  bell;~~~~~~~~~~~~~~~~~~~~~~~~ bell1;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  escape;~~~~~~~~~~~~~~~~~~~~~~ escape1;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  ignore;~~~~~~~~~~~~~~~~~~~~~~ ignore1;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  crt;~~~~~~~~~~~~~~~~~~~~~~~~~ crt1;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  auto;~~~~~~~~~~~~~~~~~~~~~~~~ auto1;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  previous;~~~~~~~~~~~~~~~~~~~~ previous1;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  disp;~~~~~~~~~~~~~~~~~~~~~~~~ disp1;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  cycle;~~~~~~~~~~~~~~~~~~~~~~~ cycle1;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  row;~~~~~~~~~~~~~~~~~~~~~~~~~ row1;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  col;~~~~~~~~~~~~~~~~~~~~~~~~~ col1;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  range;~~~~~~~~~~~~~~~~~~~~~~~ range1;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  timeout;~~~~~~~~~~~~~~~~~~~~~ timeout1;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  wait;~~~~~~~~~~~~~~~~~~~~~~~~ wait1;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 .99dr.~~~~~~~~~~~~~~~~~~~~~~~~.99db.~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  segment;~~~~~~~~~~~~~~~~~~~~~ segment1;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 (segment;~~~~~~~~~~~~~~~~~~~~~(segment1;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  cd;~~~~~~~~~~~~~~~~~~~~~~~~~~ cd1;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 (cd;~~~~~~~~~~~~~~~~~~~~~~~~~~(cd1;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  upon conslog;~~~~~~~~~~~~~~~~ upon console;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  printer;~~~~~~~~~~~~~~~~~~~~~ printer1;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  underline;~~~~~~~~~~~~~~~~~~~ underline1;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  writing;~~~~~~~~~~~~~~~~~~~~~ writing1;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  time-of-day;~~~~~~~~~~~~~~~~~ time-of-day1;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 ~~=============(end of table#1 marker '~~' in col 1&2)==========================

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

6K1. Converting YOUR Mainframe COBOL (vs supplied test/demos)

scripts to Re-convert,& Re-compile

We think you should do your 1st conversion 1 step at a time to understand the process, but after that, scripts are provided to combine the multiple steps into 1 or 2 commands.

These are particularly useful if you are fine tuning the search/replace tables, re-converting & re-compiling.

We will re-list our Operating Instructions here in a concise manner, using script cnvMF51A. This script combine the multiple uvcopy conversion jobs (cleanup, cobfil55,& cnvMF5) into 1 script.


 #1. vi ctl/cnvcob5.tbl   <-- update search/replace table for COBOL converter
     ==================     - see page '6J1'

 #2. cnvMF51A all          <-- re-convert all cobol programs
     ===========              cbl0 --> cbl1 --> cbl2

 #3. cp cbl2/* cbls       <-- copy converted programs to source library
     ==============

 #4. mfcblA all           <-- recompile all cobol programs
     ==========               cbls --> cblx

 #5. uvlpd1p cblx .err    <-- print .err reports for all compile failures
     =================

 #5a. OR, if more than just a few errors, use the cblerrs1 & cblerrs2 jobs
      documented on page '6H4' to summarize errors by failure reason,
      which is a guide to modifying the search/replace tables for
      reconversion & recompile, until the failure rate is acceptable
      for manual corrections.

converting & compiling 1 program at a time

The initial conversions should be performed 'ALL programs in directory' (using cnvMF51A), but after that cnvMF51 will be most useful to convert one program at a time during the testing period when mainframe programs are updated & need to be transferred to & converted on Unix/Linux.


 #1. cnvMF51 cbl0/PROGRAMX       <-- reconverts & prompts as follows:
     =====================         - cbl0 programs often UPPER case & no ext

copy to cbls & recompile ? --> y <--

      -- OR if you reply 'n' --

 #2. cp cbl2/programx.cbl cbls   <-- copy converted program to source library
     =========================

 #2. mfcbl1 programx.cbl         <-- recompile separately
     ===================

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

6L1. Converting YOUR Mainframe COBOL (vs supplied test/demos)

diff & alldiff - to verify changes

The Unix/Linux 'diff' utility is fantastic whenever you want to see the difference between any 2 programs, copybooks, jcls. It is useful to see the differences between the BEFORE & AFTER of some conversion process such as the COBOL conversion (see example shown below).

Note that this is the 'diff' between the programs in the 'cbl1' & 'cbl2' subdirs (after cnvMF5). See the listings on the previous 2 pages. You cannot 'diff' between 'cbl0' & 'cbl2' since cbl0 is still UPPER case & may have data in cols 1-6 &/or 73-80 which is removed by the 'cleanup' job.


 diff -b cbl1/car100.cbl cbl2/car100.cbl
 =======================================
 8,10c8,10
 <            select custmas assign custmas
 <                   organization sequential access mode sequential.
 <            select nalist assign nalist
 ---
 > uvM        select custmas assign external custmas
 > uvM               organization record sequential access mode sequential.
 > uvM        select nalist assign external nalist
 25a26
 > uvJ    01   jobid      pic  x(8).
 28a30,31
 > uvJ        display "JOBID2" upon environment-name
 > uvJ        accept jobid from environment-value.
 34c37
 <            stop run.
 ---
 > uvM        stop run returning 0.
Note
  • Specify the old file 1st & the new file 2nd, then:
  • '<' indicates the old version
  • '>' indicates the new version

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

6L2. Converting YOUR Mainframe COBOL (vs supplied test/demos)

alldiff script

The 'alldiff' script makes the 'diff' command even more powerful. The 'alldiff' script is supplied with the Vancouver Utilities (uvadm/sf/util/alldiff) to repeat the Unix/Linux 'diff' utility on each pair of files in 2 directories.

This is great whenever you are making mass changes to directories - save a copy of the original, make the mass changes,& run alldiff to confirm them.

The COBOL conversion is a good example. After the 1st conversion you will probably fine tune the conversion search/replace table & possibly the conversion tool itself (cnvMF4/cnvMF5). Before you reconvert, save the original output subdir so you can run 'alldiff' after the reconversion.

Simply change the name of the current output directory & remake a new output directory. For example, using MVS conversion job cnvMF5:


 #1a. vi ctl/cnvcob5.tbl          - modify the search/replace table
 #1b. vi pf/cnvMF5                - modify the conversion tool

 #2. mv cbls cbls.old             - change name of outdir (contains old versions)

 #3. mkdir cbls                   - make a new directory to receive new output

 #4. uvcopy cnvMF5 ...            - reconvert COBOL programs with modified
                                    table &/or cnvMF5 conversion job

 #5. alldiff cbls.old cbls |more  - run alldiff to see differences
     ===========================

 #5a. alldiff cbls.old cbls >tmp/cbls.dif  OR redirect diffs to tmp file
      ==================================

 #5b. vi tmp/cbls.dif                      inspect tmp dif file

 #5c. uvlp12 tmp/cpys.dif                  OR print tmp dif file

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

6M1. Converting YOUR Mainframe COBOL (vs supplied test/demos)

BEFORE Starting Your Testing & Debugging

Before you begin to test/debug, I strongly recommend that you consider the Cross-References documented at JCLcnv3aids.htm#Part_1. Having these reports available as you test/debug will save you a lot of time & aggravation.

Here is a summary of the types of reports documented at JCLcnv3aids.htm#Part_1.


 #1. Inventory lists & counts of all filenames in all directories of relevance.
     ==========================================================================

 #2. Contents listings of JCLs, scripts, control-cards,& copybook maps.
     ==================================================================

 #3. Cross-References of COBOL programs & JCL/scripts.
     =================================================
     - copybooks vs programs, datafiles vs Jobnames, Programs vs Jobnames

 #4. COBOL File Information reports (1 line per datafile)
     ====================================================
     - externalname, Org & Access, Open mode, record-size, copybook, internalname

 #5. JobFlow reports - combine file info from the JCL with the COBOL info above
     ==========================================================================
     - step#, programname, DLBLname1, COBOL info(above), DLBLname2

These will be explained in more detail in JCLcnv3aids.htm#Part_1 with samples & Operating Instructions to generate them using the test/demo files supplied. You will also need to have an organized way of housing them for easy access when required.

Three Ring Binders with Index Tabs

Before you start your conversion, be sure to obtain a good supply of 3-hole pre-punched paper, 3 ring binders & index tabs. The 3 ring binders should have the clear plastic pockets on the spines & covers so you can insert content identifications. The index tabs should be the 'Avery worksaver BIG TAB insertable dividers'.

Keeping your listings in 3 ring binders with Tabs to identify contents is far superior to the alternative (piles of loose paper all over the place). Note that the listings (of JCL, scripts, copybooks, etc) will appear in alphabetical sequence since unix maintains alpha sequence within directories.

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

6N1. Converting YOUR Mainframe COBOL (vs supplied test/demos)

Recommendations for Testing & Debugging

  1. When ready to test/debug each JCL/script, you will 1st copy the script from subdir 'jcl3' (auto converted JCLs) to 'jcls' where you may modify. Modify the converted Korn shell scripts only in 'jcls' (never in jcl3)

  2. If we need to reconvert (after improving converter or tables of drops in jclunixop51), we will always reconvert jcl2 -> jcl3 (never to jcls). Then we will manually copy desired jobs from 'jcl3' to 'jcls'. This protects us from destroying jobs in 'jcls', which may have had considerable effort invested in debugging & manual improvements.

  3. Copying 1 job at a time as we test/debug also provides with a means to track our progress - just listing the contents of jcls shows us the jobs already tested & debugged.


 cp jcl3/xxxxxx.ksh jcls  - copy 1 job at a time to the LIVE jcls library
 =======================    just before you test/debug each job

 xxxxxx.ksh               - execute the JCL/script to be debugged
 ==========                 $RUNLIBS/act/jcls is in the PATH for programmers

Directories used in Testing & Debugging

 /u1/apps/testlibs      <-- $RUNLIBS for programmers testing JCL/scripts
 :----act               <-- ACcTounting test libraries
 :    :-----cbls          - end point for converted COBOL programs
 :    :-----cblx          - compiled COBOL programs (.int's)
 :    :-----cpys          - converted, ready for compiles
 :    :-----jcl1          - intermediate conversion 73-80 cleared
 :    :-----jcl2          - PROCs expanded from procs
 :    :-----jcl3          - JCLs converted to Korn shell scripts
 :    :-----jcls          - copy here manually 1 by 1 during test/debug
 :    :-----maps          - 'cobmaps' record layouts generated from copybooks
 :    :-----procs         - will be merged with jcl1, output to jcl2
 :    :-----sfun          - korn shell functions (jobset51,logmsg,etc)
 :    :-----xref          - cross-references (see Part_9)
 /u3/apps/testdata      <-- $RUNDATA for programmers testing
 :     :-----act        <-- ACTng test data
 :     :     :-----apay   - subdir for data files with HLQ 'apay'
 :     :     :-----arcv   - etc
 :     :     :-----jobtmp - temporary files for SYSIN instream data
 :     :     :-----rpts   - SYSOUT reports in subdirs by yymmdd
 :     :     :-----tmp    - for uvsort
 :     :     :-----wrk    - temporary interstep files

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

6O1. Reconvert/Recompile Test/Demo COBOL copybooks/programs

reconvert COBOL copybook - 1 at a time


 cnvMF51cpy cpy0/CAR100.cpy   <-- reconvert 1 COBOL copybook thru all steps
 ========================       cpy0 --> cpy1 --> cpy2 --> ?--> cpys
                              - prompts to copy to cpys ?
 --> y <-- reply y if OK to copy to cpys overwriting prior version
 --> n <-- reply 'n' if you have spent a lot of time modifying copybook in cpys
         - might reconvert to pick up some features of converter enhancements ?
         - or improving search/replace tables
         - cut & paste to combine new parts with old parts

reconvert COBOL copybooks - All in directory


 cnvMF51Acpy all    <-- reconvert All copybook in directory
 ============        cpy0 --> cpy1 --> cpy2 --> ?--> cpys
                   - prompts to continue at various points
 --> copy UNIXWORK1 & UNIXPROC1 from /home/uvadm/mvstest/cpy0 ?
 --> y <-- reply y if 1st time conversion of this directory

--> cleanup complete, enter to convert --> y <-- reply y to continue

 --> copy All copybooks from cpy2 to cpys
 --> y <-- reply 'y' if OK to overwriting prior versions
         - when enhancements are made to COBOL converter & search/replace tables
         - before many copybooks have been modified/tested/debugged
 --> n <-- reply 'n' if you have spent a lot of time modifying copybooks in cpys

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

6O2. Reconvert/Recompile Test/Demo COBOL copybooks/programs

reconvert & recompile COBOL - 1 program at a time


 cnvMF51 cbl0/CAR100.cbl   <-- reconvert 1 COBOL program thru all steps
 =======================       cbl0 --> cbl1 --> cbl2 --> cbl3 ?--> cbls
                             - prompts to copy to cbls & recompile
 --> y <-- reply y if OK to copy to cbls overwriting prior version
 --> n <-- reply 'n' if you have spent a lot of time modifying program in cbls
         - might reconvert to pick up some features of converter enhancements ?
         - or improving search/replace tables
         - cut & paste to combine new parts with old parts

reconvert & recompile COBOL - All programs in directory


 cnvMF51A all    <-- reconvert All programs in directory
 ===========        cbl0 --> cbl1 --> cbl2 --> cbl3 ?--> cbls
                  - prompts to continue at various points
 --> cleanup complete, enter to convert
 --> y <-- reply y to continue
 --> copy All programs from cbl2 to cbls & recompile ?
 --> y <-- reply 'y' if OK to overwrite prior versions & recompile all
         - when enhancements are made to COBOL converter & search/replace tables
         - before many programs have been modified/tested/debugged
 --> n <-- reply 'n' if you have spent a lot of time modifying programs in cbls

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

6P1. Customizing Mainframe COBOL conversions

table3d - table summary conversion aid

'table3d' will create table summary counts of various items to help you to analyze conversion problems in COBOL, JCL/scripts, or any text type files.

'table3d' allows you to specify a 'key-word', preceding a 'target-word'. The job searches all lines of all files in the directory & the report shows one line for each target-word with the counts & percentages of the total line. Some examples of possible reports might be:

  1. count occurrences in COBOL of each copybook (using 'copy' as the keyword)
  2. count occurrences in JCL of each program-name (using EXEC as the keyword)
  3. count occurrences in COBOL of filenames (using 'select' as the keyword)

Note that the 'cross-reference' reports (see XREFjobs.htm) provide for the 1st 2 above, so we will use #3 as our example. Some sample 'SELECT's might be:

        SELECT PRINT-FILE     ASSIGN TO UT-S-PRINTER.
        SELECT PARM-FILE      ASSIGN TO UT-S-FPTEXT.
        SELECT AUDIT-REPORT   ASSIGN TO AUDIT.
        SELECT EPIC-FILE      ASSIGN TO EPICFILE.
        SELECT INDATA-FILE    ASSIGN TO INDATA.
        SELECT IN-CARD-FILE   ASSIGN TO INCARD.
        SELECT OUTRPT-FILE    ASSIGN TO OUTRPT.

COBOL converter option to determine file ORGANIZATION

We picked this example of 'table3d' because the COBOL converter has an option to control 'ORGANIZATION' file type on SELECT statements.

See COBOL compile op. instrns. on page '6G3'. Note the 'uvcopy cobfil55' scans the programs for 'write advancing' & writes a control file, used by the COBOL converter (uvcopy cnvMF5) to determine the ORGANIZATION file type to be coded on the SELECT statements, 'Line Sequential' if any 'advancing's found on the write statements for that file.

This action is controlled by option 'l1' on the uvcopy cnvMF5 command. If desired, you may specify 'l0', then the converter will determine organization via internal tables of keywords such as 'print', 'report', 'card', etc.

We can use the filename summary reports to modify the tables of keywords in the 'cnvMF5' uvcopy job. These keywords are different for different sites & for different languages.

 See table3d Op. Instrns. & sample report on the next page ----->

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

6P2. Customizing Mainframe COBOL conversions

Op. Instrns to create HLQ table summary


 uvcopy table3d,fild1=cbl0,arg1=select  <-- run table3d on COBOL subdir
 =====================================

sample report - summary of SELECT filenames

 Job: table3d Dir: cbl0 Keyword(s): SELECT
 Qual1:   Qual2:   Userops: q1b1c0f0l0p1w1
 table3d  2006/11/17_21:43:05  Counts by Targetword following specified Keyword
 tbl#001 pg#001     -argument-
 line#  count    %  target-word
     1       2   4   AUDIT-REPORT
     2       1   2   BATCH-REPORT
     3       1   2   EPIC-FILE
     4       1   2   FILEIN
     5       1   2   FILEOUT
     6       1   2   IN-CARD-FILE
     7       1   2   IN-FILE
     8       1   2   IN-PARM
     9       1   2   INCARD
    10       3   6   INCONT
    11       1   2   INDATA-FILE
    12       9  18   INPFLE
    13       1   2   INPNDM
    14       3   6   OUTAUD
    15       8  16   OUTFLE
    16       1   2   OUTRPT
    17       1   2   OUTRPT-FILE
    18       3   6   PARM-FILE
    19       3   6   PRINT-FILE
    20       1   2   QUANTITY-FILE
    21       2   4   RECON-REPORT
    22       1   2   REPORT-FILE
    23       1   2   TMC-FILE
    24       1   2   TOTAL-REPORT
            49*100   *TOTAL*

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

6P3. Customizing Mainframe COBOL conversions

table3d - options

Here is the console log from the 'table3d' job showing the options available.


 uvcopy table3d,fild1=cbl0   <-- specify directory on command line
 =========================     - will prompt for options, keyword, & qualifiers
 uop=q1b1c0f0l0p1w1     - option defaults
       b1               - "=" converted to blank before wordsep & count
       b2               - "/" converted to blank before wordsep & count
       b4               - "." converted to blank before wordsep & count
         c1             - bypass comments in COBOL programs (* column 7)
         c2             - bypass comments in shell scripts (# column 1)
           f0           - do not prepend/append table entry with filename
           f1           - prepend table argument with filename
           f2           - append table argument with filename
             l0         - translate lower case before matching patterns
               p1       - qualifier#1 present & qualifier#2 absent
               p2       - qualifier#1 present & qualifier#2 present
               p4       - qualifier#1 absent  & qualifier#2 absent
                 w1     - target word is 1st word following keyword
                 w2     - target word is 2nd word following keyword
                        - =,/ cnvrtd to blanks before word sep & count
 User OPtion (uop) defaults  = q1b1c0f0l0p1w1
  null to accept or re-specify (1 or more) -->
 enter search keyword, (use ":" sep if multiple) ---> SELECT <-- enter keyword
 enter qualifier#1 (null=disable) ----->
 enter qualifier#2 (null=disable) ----->    <-- enter NULL if N/R
 061118:100404:table3d: EOF fili01 rds=38 size=3002: cbl0/CAR100
 061118:100404:table3d: EOF fili01 rds=56 size=4424: cbl0/CAR200
   --------- etc (1 line counts per file) ---------
 061118:100404:table3d: EOF filo01 wrts=8 size=423: tmp/cbl0_select
 EOJ, Output File written to: tmp/cbl0_select
 enter command: vi,cat,more,lp,uvlp12,null -->

other applications for table3d

Do you see how you can run table3d to summarize other components of COBOL or JCL by choosing appropriate keywords, targetwords,& options. See more explanations at: TABLEjobs.htm#E1

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

Part_7. converting mainframe COBOL to unix/linux Micro Focus COBOL

Part 7 Contents


7A1. Introduction to Micro Focus 'screen programs'
- will demo screen Display/Accept techniques using nameadrs1.cbl
- can use to replace a few CICS programs for primarily batch migrations
- download sample program from https://www.uvsoftware.ca/nameadrs1.cbl

7B1. Directories & Files required for demo
- working directory 'testlibs' within your homedir
- subdirs cbls, cblst, cblx, ctl, dat1, dat2, sf

7C1. Setup directories, download files, and compile

7D1. Execute the program & inspect results

7E1. Extract valid records from the Indexed file

7E2. Indexed file uvhd (hexdump) showing deleted & valid records

7F1. nameadrs1.cbl sample program listing
- so you can see screen display/accept techniques before downloading

7G1. makeISF2 script to create dummy file with lowkey0 & highkey9 records
- optional, COBOL program will create file without makeISF2, but ERR msgs

7G2. makeisf2 uvcopy job called by makeISF2 script

7H1. JCL/script to execute N&A data entry demo program
- perorms 4 actions with 1 command (to save keystrokes)

7H2. JCL/script production version nameadrs2.ksh vs demo version nameadrs1.ksh
- illustrates important features of UV Software conversions

7H3. Notes about nameadrs2.ksh (production version)

7H4. JCL/script 'nameadrs3.ksh' alternate production version
- backs up N&A Indexed file to GDG file at end of job
- prompts for possible restore at begining of job

7H5. Note about nameadrs3.ksh (vs nameadrs2.ksh)

7I1. Operating Requirements for nameadrs2 & nameadrs3 (using jobset51)
- data subdirs must be in $RUNDATA (not $RUNLIBS)

7I2. Adding GDG filenames to the GDG control file
- dat2/nameadrs1_ written by nameadrs2.ksh
- dat1bak/nameadrs1_ written by nameadrs3.ksh

7I3. Activating Console Logging to aid test/debug

7I4. Sample console log from executing nameadrs3.ksh

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

7A1. converting mainframe COBOL to unix/linux Micro Focus COBOL

Micro Focus COBOL SCREEN program demo

'nameadrs1.cbl' is a Name & Address Data Entry program that illustrates the powerful screen display/accept capabilities provided with Micro Focus COBOL. If you have installed the Vancouver Utilities, you will find 'nameadrs1.cbl' at /home/uvadm/mf/cbls/nameadrs1.cbl. If you do not have Vancouver Utilities, you may download the demo program from https://www.uvsoftware.ca/nameadrs1.cbl.

This is significant news for mainframe sites migrating to Unix/Linux. If the mainframe applications are mostly 'batch' with just a few online CICS programs, you can use Micro Focus screen programs to replace the few CICS programs.

Of course if you have a lot of online/CICS programs, you would use the Micro Focus 'MTO' option (Mainframe Terminal Option) to emulate CICS on Unix/Linux.

Micro Focus also provide 'JES' (JCL Emulation), but most migrations will be better served by converting the JCL to Korn shell or Perl scripts, because it is difficult to insert Unix/Linux commands/scripts into JCL. The JCL emulator only runs COBOL and the expected mainframe utilities, which means you have to write a COBOL program to call any desired Unix/Linux command/script.

When you use the UV Software JCL converters, you can easily integrate any Unix/Linux commands, scripts, & a vast array of open systems software into your converted Korn shell or Perl scripts.

Micro Focus COBOL Accept/Display Documentation

Please see 'Character User Interfaces' at:


 https://supportline.microfocus.com/Documentation/books/sx51/sx51ind
 =========================================================================

There are a few demo programs provided in $COBDIR/demo/..., but none as realistic as the 'nameadrs1.cbl' demonstrated and listed on the website at https://www.uvsoftware.ca/mvscobol.htm#Part_7

    ********************************************************************
    *                                                                  *
    *                 ** Name & Address Entry Screen **                *
    *                                                                  *
    *    Telephone: [ 6049805434   ]                                   *
    *    Name:      [ TOWNSEND, OWEN                 ] (Last, First)   *
    *    Address1:  [ 4667 HOSKINS RD.               ]                 *
    *    Address2:  [                                ]                 *
    *    City:      [ NORTH VANCOUVER                ]                 *
    *    State:     [ BC                             ]                 *
    *    Zip:       [ V7K2R3                                           *
    *                                                                  *
    *    Message:                                                      *
    *                                                                  *
    *    Command---> ______________________________ <---               *
    *    a=add,c=change,d=delete,n=next,p=prior,b=Blankscreen,q=quit   *
    *                                                                  *
    ********************************************************************

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

7B1. Micro Focus COBOL SCREEN program demo

Directories & Files required for demo

Please see the script at: https://www.uvsoftware.ca/mvscobol.htm#5E1 To compile & execute the program we will need the subdirs shown below. We suggest you set these up within a 'testlibs' working directory within your homedir.

 /home/userxx
 :-----:testlibs
 :     :-----cbls                <-- COBOL source programs
 :     :     :-----nameadrs1.cbl   - Name & Address demo program
 :     :     :
 :     :-----cblst
 :     :     :-----nameadrs1.lst   - listing created by compiler
 :     :     :
 :     :-----cblx                <-- compiler output subdir
 :     :     :-----nameadrs1.int   - interpretive code executed by cobrun
 :     :     :-----nameadrs1.idy   - required by debugger (animator)
 :     :     :-----nameadrs1.cbl   - copy of source required by debugger
 :     :     :
 :     :-----ctl                 <-- control files (for compiler)
 :     :     :-----cobdirectives   - COBOL Directives
 :     :     :-----extfh.cfg       - file handler configuration file
 :     :     :
 :     :-----dat1                <-- data files subdir
 :     :     :-----nameadrs1.dat   - Name & Address Indexed file - data
 :     :     :-----nameadrs1.idx   - index partition of N&A file
 :     :     :
 :     :-----dat2                <-- subdir for extracted file
 :     :     :-----nameadrs1       - Name & Address Sequential file
 :     :     :                     - with any deleted records dropped
 :     :     :
 :     :-----sf                  <-- Script Files subdir
 :     :     :-----mfcbl1          - COBOL compile script
 :     :     :

The DATA subdirs are shown here in the testlibs/... superdir for simplicity. This is OK for out 1st test executing the COBOL program directly, but for production scripts the DATA subdirs are requried to be in testdata/...

If you do NOT have Vancouver Utilities, you can download the test files from the website: The program is provided as a separate file. The script & control files can be cut & pasted from the documentation.

 https://www.uvsoftware.ca/nameadrs1.cbl       - COBOL source program
 https://www.uvsoftware.ca/mvscobol.htm#5E1    - compile script
 https://www.uvsoftware.ca/mvscobol.htm#5D1    - compile Directives
 https://www.uvsoftware.ca/mvscobol.htm#5D2    - file handler configuration

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

7C1. Micro Focus COBOL SCREEN program demo

setup directories, download,& compile


 #1. Login as yourself --> your homedir

 #2. mkdir testlibs    <-- make a working directory for this project
     ==============        within your homedir

 #3. cd testlibs       <-- change to the project working directory
     ===========

 #4. mkdir cbls cblst cblx ctl dat1 sf  <-- make subdirs for this project
     =================================

 #5. download the Input files from the website:
     ==========================================

 #5a. https://www.uvsoftware.ca/nameadrs1.cbl    --> cbls/nameadrs1.cbl program
 #5b. https://www.uvsoftware.ca/mvscobol.htm#5E1 --> sf/mfcbl1 (compile script)
 #5c. https://www.uvsoftware.ca/mvscobol.htm#5D1 --> ctl/cobdirectives
 #5d. https://www.uvsoftware.ca/mvscobol.htm#5D2 --> ctl/extfh.cfg

 #6. chmod 775 sf/mfcbl1      <-- add executable permissions onto the script
     ===================

 #6. sf/mfcbl1 nameadrs.cbl   <-- compile the program
     ======================

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

7D1. Micro Focus COBOL SCREEN program demo

execute the program


 #1. Login --> your homedir

 #2. cd testlibs     <-- change to the project working directory
     ===========

 #3. makeISF2 dat1/nameadrs1 255 0,10,10,30  <-- init file with 2 dummy records
     ======================================    - lowkey zeros & highkey nines
     - optional, ONLY if FIRST time or intentionally creating new file

 #4. export NAMEADRS=dat1/nameadrs1
     ==============================
     - export logical name (used by program) to the physical file name path

 #5. cobrun cblx/nameadrs1    <-- execute the program
     =====================
     - enter N&A for yourself & some of your friends
     - try out various commands documented on 2nd page of source listing
     - Add, Change, Delete, browse Next or Prior, by key1(Tel#) or key2(Name)
    ********************************************************************
    *                                                                  *
    *                 ** Name & Address Entry Screen **                *
    *                                                                  *
    *    Telephone: [ 6049805434   ]                                   *
    *    Name:      [ TOWNSEND, OWEN                 ] (Last, First)   *
    *    Address1:  [ 4667 HOSKINS RD.               ]                 *
    *    Address2:  [                                ]                 *
    *    City:      [ NORTH VANCOUVER                ]                 *
    *    State:     [ BC                             ]                 *
    *    Zip:       [ V7K2R3                                           *
    *                                                                  *
    *    Message:                                                      *
    *                                                                  *
    *    Command---> ______________________________ <---               *
    *    a=add,c=change,d=delete,n=next,p=prior,b=Blankscreen,q=quit   *
    *                                                                  *
    *                     ** Command Examples **                       *
    *    --> a,b      <-- Add record & Blank screen for next add       *
    *    --> a        <-- Add, No Blank for multi names same adrs      *
    *    --> n1,,604  <-- read Next record key1 => 604.......          *
    *    --> n2,,SMIT <-- read Next record key2 => SMIT......          *
    *    --> c,n      <-- Change current record & read Next            *
    *    HomeKey=1stField, EndKey=CommandField, TabKey=NextField       *
    *                                                                  *
    ********************************************************************

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

7D2. Micro Focus COBOL SCREEN program demo


 #6. vi dat1/nameadrs1.dat   <-- inspect output (data partition)
     =====================

Notes

  1. Indexed file Output will be nameadrs1.dat (data) & nameadrs1.idx (index).

  2. The file handler config file (extfh.cfg) specifies 'IDXNAMETYPE=2', which appends the '.dat' extension on the data partition. Otherwise it would have no extension.

  3. The program will create the file on the 1st open, if it does not already exist.

  4. After opening the program attempts to read & display the 1st record. You will see an error msg if the file does not exist, but you can ignore it and start adding some records.

  5. We provide an optional script 'makeISF2' to create 2 dummy records (low key zeros & high key nines). These will prevent the error msg on the 1st file open before any records have been added.

  6. The makeISF2 script calls uvcopy job 'makeisf2', which requires the 'uvcopy' interpreter (part of the Vancouver Utilities pkg). See makeISF2 script & uvcopy job makeisf2 listed on pages '7G1' & '7G2'.

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

7E1. Micro Focus COBOL COBOL SCREEN program demo

extracting valid records from the file

We will assume the valid N&A records will be input to a COBOL batch process that expects a sequential file (vs the Indexed file used for data entry). We needed an Indexed file for data entry to allow us to access records by key for change & delete.

The extract job will drop the deleted records and also the lowkey/highkey zeros/nines records created by the optional makeISF2 script.

Note that deleted records in Indexed files are flagged with x'00' in the last byte of the record & these are automatically bypassed when read by the indexed file handler.

The following extraction method uses the 'uvcp' Vancouver Utility. If you do not have Vancouver Utilities, you could simply modify your COBOL program to read the indexed file directly.


 #1. Login --> your homedir

 #2. cd testlibs     <-- change to the project working directory
     ===========

 #3. uvcp "fili1=dat1/nameadrs1,rcs=255,typ=ISF,filo1=dat2/nameadrs1,typ=RST\
     =========================================================================
           ,del=0(10):0000000000,del=0(10):9999999999"
           ===========================================

notes

  1. You might try the above uvcp as a test, but for production you would include the uvcp command line at the front end of your JCL/script prior to the COBOL program expecting the N&A sequential file input.

  2. Or as noted above (if you do not have Vancouver Utilities), simply modify your COBOL program to input the indexed file directly.

  3. Note that 'typ=ISF' is 'Indexed Sequential File' and 'typ=RST' is 'Record Sequential Terminated'. typ=RST inserts a x'0A' (LineFeed) in the last byte to allow you to inspect the records with 'vi', 'more', 'lp', etc. 'typ=RSF' would have no LineFeeds & the file would appear as 1 long line to the usual unix/linux utilities (vi, more, lp, etc).

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

7E2. Micro Focus COBOL SCREEN program demo

Indexed file displayed with uvhd


 uvhd dat1/nameadrs1.dat r256h2   <-- display N&A file with uvhd
 ==============================     - option 'r256' means recsize=256
                                    - option 'h2' displays in hexadecimal
                      10        20        30        40        50        60
 r#        1 0123456789012345678901234567890123456789012345678901234567890123
           0 0000000000
             3333333333222222222222222222222222222222222222222222222222222222
             0000000000000000000000000000000000000000000000000000000000000000
          64
             2222222222222222222222222222222222222222222222222222222222222222
             0000000000000000000000000000000000000000000000000000000000000000
         128
             2222222222222222222222222222222222222222222222222222222222222222
             0000000000000000000000000000000000000000000000000000000000000000
         192                                                                .
             2222222222222222222222222222222222222222222222222222222222222220
             0000000000000000000000000000000000000000000000000000000000000000
                      10        20        30        40        50        60
 r#        2 0123456789012345678901234567890123456789012345678901234567890123
         256 6049805434TOWNSEND, OWEN
             3333333333545454442245442222222222222222222222222222222222222222
             60498054344F7E35E4C0F75E0000000000000000000000000000000000000000
          64                                     NORTH VANCOUVER
             2222222222222222222222222222222222224455425444455452222222222222
             000000000000000000000000000000000000EF248061E3F56520000000000000
         128   BC                            V7K2R3
             2244222222222222222222222222222253435322222222222222222222222222
             0023000000000000000000000000000067B22300000000000000000000000000
         192                                                                .
             2222222222222222222222222222222222222222222222222222222222222220
             000000000000000000000000000000000000000000000000000000000000000A

Notes

  1. We use 'uvhd' so we can see the hexadecimal codes for the delete/valid record flags at the end of each record.

  2. Note that 'uvhd' is the 1 FREE utility that you may download from https://www.uvsoftware.ca/freestuff.htm.

  3. The 1st record (key1=0000000000) was deleted. Note the x'00' in last byte. The indexed file handler will automatically bypass, but uvhd reads everything in the file.

  4. Owen's record was not deleted. Note the x'0A' in the last byte. Micro Focus COBOL used x'0A' for valid records because that is a LineFeed, which allows use of the standard unix/linux utilities (vi, more, lp, etc). Otherwise the entire file would appear as 1 long record to vi,more,lp,etc.

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

7F1. Micro Focus COBOL SCREEN program demo

nameadrs1.cbl program listing

        id division.
        program-id. nameadrs1.
       *****************************************************************
       * Name & Address Data Entry Program, by Owen Townsend, June 2009
       * - Demo data entry screen program for Micro Focus COBOL
       * See documentation at: www.uvsoftware.ca/mvscobol.htm#Part_7
       * - subdirs required, compiling, testing, verifying
       * You may download from: www.uvsoftware.ca/nameadrs1.cbl
       *
       *                 ** Name & Address Entry Screen **
       *
       *    Telephone: [ 6049805434   ]
       *    Name:      [ TOWNSEND, OWEN                 ] (Last, First)
       *    Address1:  [ 4667 HOSKINS RD.               ]
       *    Address2:  [                                ]
       *    City:      [ NORTH VANCOUVER                ]
       *    State:     [ BC                             ]
       *    Zip:       [ V7K2R3
       *
       *    Message:
       *
       *    Command---> ______________________________ <---
       *    a=add,c=change,d=delete,n=next,p=prior,b=Blankscreen,q=quit
       *                     ** Command Examples **
       *    --> a,b      <-- Add record & Blank screen for next add
       *    --> a        <-- Add, No Blank for multi names same adrs
       *    --> n1,,604  <-- read Next record key1 => 604.......
       *    --> n2,,SMIT <-- read Next record key2 => SMIT......
       *    --> c,n      <-- Change current record & read Next
       *    HomeKey=1stField, EndKey=CommandField, TabKey=NextField
       *
       *                     ** record layout **
       * 01  na-rec.
       *     05 na-tel         pic x(010).                0000 0009  010
       *     05 na-name        pic x(030).                0010 0039  030
       *     05 na-adrs1       pic x(030).                0040 0069  030
       *     05 na-adrs2       pic x(030).                0070 0099  030
       *     05 na-city        pic x(030).                0100 0129  030
       *     05 na-state       pic x(030).                0130 0159  030
       *     05 na-zip         pic x(012).                0160 0171  012
       *     05 filler001      pic x(083).                0172 0254  083
       *
       * logical rec-size=255 (ISAM), physical rec-size=256 (for uvhd)
       * key1 = telephone#, key2 = name
       *

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

       *                   ** commands **
       *
       * a=add, c=change, d=delete, n1=nextkey1, n2=nextkey2,
       * p1=priorkey1, p2=priorkey2, b=blankscreen, q=quit
       *
       * arg1=a/c/d/n1/n2/p1/p2/b/q
       * arg2=b/n1/n2
       * arg3=999 - 1st few digits of Next/Prior key1 (tel#)
       * arg3=XXX - 1st few chars of Next/Prior key2 (name)
       *
       * a          - Add record, do not Blank screen
       *              (allows change current N&A for next similar N&A)
       * a,b        - Add record & Blank screen for next enter
       * a,n1       - Add & get Next key1 (for change ?)
       * a,n2       - Add & get Next key2 (for change ?)
       * a,n1,604   - Add & get Next key1 > 604........
       * a,n2,SMITH - Add & get Next key2 > SMITH......
       *
       * c          - Change record (allows same arg2 & arg3 as Add)
       * d          - Delete record (allows same arg2 & arg3 as Add)
       *
       * n1         - get Next record by key1 (higher than current key1)
       * n          - 'n' defaults to 'n1'
       * n2         - get Next record by key2 (higher than current key2)
       * n1,,604    - get Next by key1 (higher than arg3)
       * n2,,SMITH  - get Next by key2 (higher than arg3)
       *
       * p          - get Prior record (allows same arg2 & arg3 as Next)
       * b          - Blank screen (to Add a new record ?)
       * q          - Quit the program
       *
       *               ** compile & test program **
       *
       * 1. mfcbl1 program.cbl             <-- compile program
       * 2. makeISF2 dat1/nameadrs1 255 0,10,10,30 <- create 2 dummy recs
       * 3. export NAMEADRS=dat1/nameadrs1 <-- export external name
       * 4. cobrun cblx/nameadrs1          <-- execute program
       * 5. vi dat1/nameadrs1.dat          <-- investigate with vi
       *
       * compile script at:  'https://www.uvsoftware.ca/mvscobol.htm#5E1'
       * subdir setup at:    'https://www.uvsoftware.ca/mvscobol.htm#7B1'
       * Directives at:      'https://www.uvsoftware.ca/mvscobol.htm#5D1'
       * file handler config 'https://www.uvsoftware.ca/mvscobol.htm#5D1'
       * Error codes at:     'https://www.uvsoftware.ca/cnvaids.htm#5F1'
       *
       * makeISF2 not essential, will create file (ignore err #23 N/F)
       *

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

        environment division.
        special-names.
            console is crt
            cursor is cursr
            crt status is key-status.
        input-output section.
        file-control.
            select nameadrs assign external nameadrs
                organization is indexed
                access is dynamic
                record key is na-tel
                alternate key is na-name with duplicates
                file status is na-status.
        data division.
        file section.
        fd  nameadrs.
        01  na-rec.
            05 na-tel         pic x(010).
            05 na-name        pic x(030).
            05 na-adrs1       pic x(030).
            05 na-adrs2       pic x(030).
            05 na-city        pic x(030).
            05 na-state       pic x(030).
            05 na-zip         pic x(012).
            05 filler         pic x(083).
       *
        working-storage section.
        01 ws1-rec.
            05 ws1-tel        pic x(010).
            05 ws1-name       pic x(030).
            05 ws1-adrs1      pic x(030).
            05 ws1-adrs2      pic x(030).
            05 ws1-city       pic x(030).
            05 ws1-state      pic x(030).
            05 ws1-zip        pic x(012).
            05 filler         pic x(083).
       *
        01 ws2-rec.
            05 ws2-tel        pic x(010).
            05 ws2-name       pic x(030).
            05 ws2-adrs1      pic x(030).
            05 ws2-adrs2      pic x(030).
            05 ws2-city       pic x(030).
            05 ws2-state      pic x(030).
            05 ws2-zip        pic x(012).
            05 filler         pic x(083).
       *
        01  na-stuff.
            05 na-status      pic x(2).
            88 na-status-fnf  value "35".
            88 na-status-rnf  value "23".
            88 na-status-eof  value "10".
            05 na-namexln     pic x(8) value "NAMEADRS".
            05 na-namexfn     pic x(60) value spaces.
            05 na-commas      pic 9(3) value zero.
       *

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

        01  cmds.
            05  cmd1          pic x(30).
            05  cmd2          pic x(30).
        01  cmdxs.
            05 cmdx           pic x(30).
            05 cmdx1          pic x(30).
            05 cmdx2          pic x(30).
            05 cmdx3          pic x(30).
            05 cmdx4          pic x(30).
            05 cmdx11         pic x.
            05 cmdx12         pic x.
            05 cmdx21         pic x.
            05 cmdx22         pic x.
            05 cmdx31         pic x.
            05 cmdx32         pic x.
       *
        01  msgs.
            05 msg1           pic x(60).
            05 msg2           pic x(60).
       *
        01  cursr.
            05 cursr-row      pic 99.
            05 cursr-col      pic 99.
       *
        01  key-status.
            05 key-type       pic x.
            05 key-code1      pic 99 comp-x.
            05 key-code2      pic 99 comp-x.
       *

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

       *            ** screen section **
        screen section.
        01 screen1.
           03 blank screen.
           03 line 03 column 17 value
                                "** Name & Address Entry Screen **".
       *
           03 line plus 2 column 04 value "Telephone: [ ".
           03         column 17 pic 9(10) using ws1-tel.
           03         column 29 value " ]".
           03 line plus 1 column 04 value "Name:      [ ".
           03         column 17 pic x(30) using ws1-name.
           03         column 47 value " ] (Lastname, Firstname)".
           03 line plus 1 column 04 value "Address1:  [ ".
           03         column 17 pic x(30) using ws1-adrs1.
           03         column 47 value " ]".
           03 line plus 1 column 04 value "Address2:  [ ".
           03         column 17 pic x(30) using ws1-adrs2.
           03         column 47 value " ]".
           03 line plus 1 column 04 value "City:      [ ".
           03         column 17 pic x(30) using ws1-city.
           03         column 47 value " ]".
           03 line plus 1 column 04 value "State:     [ ".
           03         column 17 pic x(30) using ws1-state.
           03         column 47 value " ]".
           03 line plus 1 column 04 value "Zip:       [ ".
           03         column 17 pic x(12) using ws1-zip.
           03         column 27 value " ]".
       *
           03 line plus 2 column 04 value "Message: ".
           03         column 17 pic x(60) from msg1.
           03 line plus 1 column 17 pic x(60) from msg2.
       *
           03 line plus 1 column 04 value "Command---> ".
           03         column 16 pic x(30) to cmd2.
           03         column 46 value " <---".
           03 line plus 1 column 04 value
              "a=add, c=change, d=delete, n=next, p=prior, ".
           03         column 48 value "b=Blank screen, q=quit".
       *
           03 line plus 1 column 21 value "** Command Examples **".
           03 line plus 1 column 04 value
              "--> a,b      <-- Add record & Blank screen for next add".
           03 line plus 1 column 04 value
              "--> a        <-- Add, No Blank for multi names same adrs".
           03 line plus 1 column 04 value
              "--> n1,,604  <-- read Next record key1 => 604.......".
           03 line plus 1 column 04 value
              "--> n2,,SMIT <-- read Next record key2 => SMIT......".
           03 line plus 1 column 04 value
              "--> c,n      <-- Change current record & read Next".
           03 line plus 1 column 04 value
              "HomeKey=1stField, EndKey=CommandField, TabKey=NextField".
       *

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

        procedure division.
        init.
            perform open-na.
            initialize na-rec.
            perform readkey1n.
       *
        mainloop.
            move na-rec to ws1-rec.
            initialize cmds.
            move 15 to cursr-row.
            move 04 to cursr-col.
            perform display-screen1.
            accept screen1.
            move ws1-rec to ws2-rec.
            initialize msgs.
            perform cmdextract.
       *
       * test command1 (a,c,d,n,b,q)
            if      cmdx11 = 'a' perform addrecord
            else if cmdx11 = 'c' perform changerecord
            else if cmdx11 = 'd' perform deleterecord
            else if cmdx11 = 'n' perform nextrecord
            else if cmdx11 = 'p' perform priorrecord
            else if cmdx11 = 'b' perform blankscreen
            else if cmdx11 = 'q' perform quitprogram
            else move "command1 invalid (not a,c,d,n,b,q)" to msg1.
            go to mainloop.
       *
       * open nameadrs file
        open-na section.
            display na-namexln upon environment-name.
            accept na-namexfn from environment-value.
            if na-namexfn (1:1) < '0'
               string "filename: ", na-namexln, " NOT exported"
                      delimited by size into msg1
               string "export NAMEADRS=dat1/nameadrs1  <-- example"
                      delimited by size into msg2
               display screen1
               stop run returning na-status.
            open I-O nameadrs.
            if na-status <> "00"
               string "Next key > read ERROR, file-status = "
                      na-status delimited by size into msg1
               string "filename: ", na-namexln, "=" na-namexfn,
                      delimited by size into msg2
               display screen1.
       ***     stop run returning na-status.
       *** cmtd out to run when dummy file not init'd with makeISF2
            exit section.
       *

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

       * verify data to be displayed & display screen
       * - verify telephone# numeric (to prevent "illegal char errmsg")
        display-screen1 section.
            if ws1-tel = spaces move zeros to ws1-tel.
            if ws1-tel not numeric
               string "Tel# ", ws1-tel,
                      " must be numeric, zero filled for display"
                      delimited by size into msg2
               move zeros to ws1-tel.
            display screen1.
            exit section.
       *
       * extract command components from 30 byte cmd input area
       * arg1=a/c/d/n1/n2/p1/p2/b/q
       * arg2=b/n1/n2
       * arg3=999 - 1st few digits of Next/Prior key1 (tel#)
       * arg3=XXX - 1st few chars of Next/Prior key2 (name)
        cmdextract section.
            initialize cmdxs.
            move cmd2 to cmdx.
            unstring cmdx delimited by ','
                         into cmdx1, cmdx2, cmdx3, cmdx4.
            move cmdx1 to cmdx11.
            move cmdx2 to cmdx21.
            move cmdx3 to cmdx31.
            move cmdx1 (2:1) to cmdx12.
            move cmdx2 (2:1) to cmdx22.
            move cmdx3 (2:1) to cmdx32.
            exit section.
       *

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

       * process cmd 'a' = addrecord
       * a          - Add record, do not Blank screen
       * a,b        - Add record & Blank screen for next enter
       * a,n1       - Add & get Next key1 (for change ?)
       * a,n2       - Add & get Next key2 (for change ?)
       * a,n1,604   - Add & get Next key1 > 604........
       * a,n2,SMITH - Add & get Next key2 > SMITH......
        addrecord section.
            move ws1-rec to na-rec.
            call "CBL_TOUPPER" using na-rec by value length na-rec.
            move zero to na-commas.
            inspect na-name tallying na-commas for all ','.
            if na-commas = 0 move
               "name must include a comma (Lastname, Firstname)" to msg1
               exit section.
            write na-rec.
            if na-status <> "00"
               string "add record ERROR, file-status = "
                      na-status delimited by size into msg1
               string "filename: ", na-namexln, "=" na-namexfn,
                      delimited by size into msg2
                      exit section.
            if cmdx21 = 'b' initialize na-rec.
            if cmdx21 = 'n' perform getnext.
            exit section.
       *
       * process cmd 'c' = changerecord
       * Change record options - same arg2 & arg3 options as Add
        changerecord section.
            move ws1-rec to na-rec.
            call "CBL_TOUPPER" using na-rec by value length na-rec.
            move zero to na-commas.
            inspect na-name tallying na-commas for all ','.
            if na-commas = 0 move
               "name must include a comma (Lastname, Firstname)" to msg1
               exit section.
            rewrite na-rec.
            if na-status <> "00"
               string "change record ERROR, file-status = "
                      na-status delimited by size into msg1
               string "filename: ", na-namexln, "=" na-namexfn,
                      delimited by size into msg2
                      exit section.
            if cmdx21 = 'b' initialize na-rec.
            if cmdx21 = 'n' perform getnext.
            exit section.
       *

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

       * process cmd 'd' = deleterecord
       * Delete record options - same arg2 & arg3 options as Add
        deleterecord section.
            move ws1-rec to na-rec.
            delete nameadrs.
            if na-status <> "00"
               string "delete record ERROR, file-status = "
                      na-status delimited by size into msg1
               string "filename: ", na-namexln, "=" na-namexfn,
                      delimited by size into msg2
                      exit section.
            move "record DELETED" to msg1.
            if cmdx21 = 'b' initialize na-rec.
            if cmdx21 = 'n' perform getnext.
            exit section.
       *
       * process cmd 'n' = read Next record with key >
       * nextrecord command examples & options:
       * n1         - get Next record by key1 (higher than current key1)
       * n2         - get Next record by key2 (higher than current key2)
       * n1,,604    - get Next by key1 (higher than arg3)
       * n2,,SMITH  - get Next by key2 (higher than arg3)
        nextrecord section.
            move cmdx12 to cmdx22.
            perform getnext.
            exit section.
       *
       * process cmd 'p' = read Prior record with key <
       * priorrecord options - same as nextrecord (see above)
        priorrecord section.
            move cmdx12 to cmdx22.
            perform getprior.
            exit section.
       *
       * process cmd 'b' = Blank screen
        blankscreen section.
            initialize na-rec.
            exit section.
       *
       * process cmd 'q' = Quit program
        quitprogram section.
            move "program terminated by Quit command" to msg1.
            display screen1.
            stop run returning 0.
            exit section.
       *

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

       * getnext record by key 1 or 2 (1 or 2 stored in cmdx22)
        getnext.
            initialize na-rec.
            if cmdx22 = '2'
               move ws2-name to na-name
               if cmdx31 <> ' '
                  move cmdx3 to na-name
               end-if
               perform readkey2n
            else
               move ws2-tel  to na-tel
               if cmdx31 <> ' '
                  move cmdx3 to na-tel
               end-if
               perform readkey1n
            end-if.
            exit section.
       *
       * getprior record by key 1 or 2 (1 or 2 stored in cmdx22)
        getprior.
            initialize na-rec.
            if cmdx22 = '2'
               move ws2-name to na-name
               if cmdx31 <> ' '
                  move cmdx3 to na-name
               end-if
               perform readkey2p
            else
               move ws2-tel  to na-tel
               if cmdx31 <> ' '
                  move cmdx3 to na-tel
               end-if
               perform readkey1p
            end-if.
            exit section.
       *

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

       * read next record with key1 > na-tel
        readkey1n section.
            start nameadrs key > na-tel.
            if na-status <> "00"
               string "Next key > start ERROR, file-status = "
                      na-status delimited by size into msg1
               string "filename: ", na-namexln, "=" na-namexfn,
                      delimited by size into msg2
                      exit section.
            read nameadrs next.
            if na-status <> "00"
               string "Next key > read ERROR, file-status = "
                      na-status delimited by size into msg1
               string "filename: ", na-namexln, "=" na-namexfn,
                      delimited by size into msg2.
            exit section.
       *
       * read next record with key2 > na-name
        readkey2n section.
            start nameadrs key > na-name.
            if na-status <> "00"
               string "Next key > start ERROR, file-status = "
                      na-status delimited by size into msg1
               string "filename: ", na-namexln, "=" na-namexfn,
                      delimited by size into msg2
                      exit section.
            read nameadrs next.
            if na-status <> "00"
               string "Next key > read ERROR, file-status = "
                      na-status delimited by size into msg1
               string "filename: ", na-namexln, "=" na-namexfn,
                      delimited by size into msg2.
            exit section.
       *

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

       * read Prior record with key1 < na-tel
        readkey1p section.
            start nameadrs key < na-tel.
            if na-status <> "00"
               string "Prior key < start ERROR, file-status = "
                      na-status delimited by size into msg1
               string "filename: ", na-namexln, "=" na-namexfn,
                      delimited by size into msg2
                      exit section.
            read nameadrs previous.
            if na-status <> "00"
               string "Prior key < read ERROR, file-status = "
                      na-status delimited by size into msg1
               string "filename: ", na-namexln, "=" na-namexfn,
                      delimited by size into msg2.
            exit section.
       *
       * read Prior record with key2 < na-name
        readkey2p section.
            start nameadrs key < na-name.
            if na-status <> "00"
               string "Prior key < start ERROR, file-status = "
                      na-status delimited by size into msg1
               string "filename: ", na-namexln, "=" na-namexfn,
                      delimited by size into msg2
                      exit section.
            read nameadrs previous.
            if na-status <> "00"
               string "Prior key < read ERROR, file-status = "
                      na-status delimited by size into msg1
               string "filename: ", na-namexln, "=" na-namexfn,
                      delimited by size into msg2.
            exit section.
       ************************ end nameadrs1 *************************

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

7G1. Micro Focus COBOL SCREEN program demo

makeISF2 create dummy lowkey/highkey records

 #!/bin/ksh
 # makeISF2 - script to create 2 key Indexed file with 2 dummy records
 #          - low key record '0's in key1, blanks in key2
 #          - high-key record '9's in key1, 'z's in key2
 #
 # makeISF2 filename recsize keys        <-- format
 # ==============================
 #
 # makeISF2 dat1/nameadrs1 255 0,10,10,30  <-- example
 # ======================================
 #
 #         ** script 'makeISF2' calls uvcopy job 'makeisf2' **
 #
 # uvcopy makeisf2,filo1=filename,rcs=recsize,isks=(k1d,k1l,k2d,k2l,etc) <-format
 # =====================================================================
 #
 # uvcopy makeisf2,filo1=dat1/nameadrs1,rcs=255,isks=(0,10,10,30) <-- example
 # ==============================================================
 #
 #Jun08/09 - init low key record key to '0's & high key rec key to 'z's
 #
 if [[ $# -ne 3 ]]; then
    echo "usage: makeISF2 filename rcsz key1strt,key1lth,key2strt,key2lth,etc"
    exit 9; fi
 #
 echo "init the file, destroying any existing records OK ? y/n"; read reply
 if [[ "$reply" == "y" ]]; then
 uvcopy "makeisf2,filo1=$1,rcs=$2,isks=($3),typ=ISFl0h1s4"
 else echo "init file cancelled"; fi
 exit 0
Note
  • makeISF2 is optional, COBOL program will create file without it
  • but this avoids errmsg when COBOL tries to read/display 1st record
  • and when using Next command to add records at end of file
  • the uvcp valid record extraction utility will drop the 0/9 records

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

7G2. Micro Focus COBOL SCREEN program demo

makeisf2 uvcopy job called by makeISF2 script

 # makeisf2 - create 2 key Indexed file with 2 dummy records low-key & high-key
 #          - low key record '0's in key1, blanks in key2
 #          - high-key record '9's in key1, 'z's in key2
 #
 # uvcopy makeisf2,filo1=filename,rcs=recsize,isks=(k1d,k1l,k2d,k2l,etc) <-format
 # =====================================================================
 #
 # uvcopy makeisf2,filo1=dat1/nameadrs1,rcs=256,isks=(0,10,10,30) <-- example
 # ==============================================================
 #
 #         ** script 'makeISF2' to call this 'makeisf2' job **
 #
 # makeISF2 filename recsize keys        <-- format
 # ==============================
 #
 # makeISF2 dat1/nameadrs1 256 0,10,10,30  <-- example
 # ======================================
 #
 was=a8192
 filo1=?isamfilename,rcs=999,isks=(0,9,99,99),typ=ISFl0h1s4
 #note - filename, recsize,& keys are specified by calling script
 @run
        opn   filo1
 # set low key record '0's in key1, blanks in key2
 # set high-key record '9's in key1, 'z's in key2
        mvn   $ra,$filo1+604(2b)   capture key1 dsp in rgstr 'a'
        mvn   $rb,$filo1+606(2b)   capture key1 lth in rgstr 'b'
        mvn   $rc,$filo1+636(2b)   capture key2 dsp in rgstr 'c'
        mvn   $rd,$filo1+638(2b)   capture key2 lth in rgstr 'd'
        clr   aa0($rb50),'0'       fill low rec key1 rec key with '0's
        clr   ac0($rd50),' '       fill low rec key2 rec key with ' 's
        put   filo1,a0             write low key record #1
        clr   aa0($rb50),'9'       fill low rec key1 rec key with '9's
        clr   ac0($rd50),'z'       fill low rec key2 rec key with 'z's
        put   filo1,a0             write high key record #2
        cls   filo1
        eoj
Note
  • uvcopy supplies mainframe functionality missing on Unix/Linux systems
  • access to Indexed files, packed decimal fields, bigend/little end binary
  • uvcopy can replace mainframe utilities (Ditto,Fileaid,Easytrieve,etc)
  • see the uvcopy utility doc at: https://www.uvsoftware.ca/uvcopy1.htm

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

7H1. Micro Focus COBOL SCREEN program demo

script to execute nameadrs1 etc

 #!/bin/ksh
 # nameadrs1.ksh - script to execute Name & Address data entry
 #               - by Owen Townsend, UV Software, June 2009
 #               - to demo Micro Focus screen display/accept techniques
 #               - see doc at www.uvsoftware.ca/mvscobol.htm#Part_7
 #
 # nameadrs1.ksh   <-- execute this script
 # =============     - script combines 4 actions:
 #
 # 1. makeISF2      - init N&A data file (if operator replies y at prompt)
 # 2. export COBOL program logical filename to physical filename
 # 3. nameadrs1.cbl - executes the N&A data entry program
 # 4. uvcp ...      - executes uvcp to extract valid records for COBOL prcsng
 #
 makeISF2 dat1/nameadrs1 255 0,10,10,30  # init file lowkey0/highkey9 records
 #=====================================    - ONLY if oprtr reply 'y' at prompt
 #
 export NAMEADRS=dat1/nameadrs1  # export COBOL logical name to data filename
 #=============================
 #
 cobrun cblx/nameadrs1    # execute Name & Address screen data entry program
 #====================
 #
 uvcp "fili1=dat1/nameadrs1,rcs=255,typ=ISF,filo1=dat2/nameadrs1,typ=RST\
 ,del=0(10):0000000000,del=0(10):9999999999"
 #=======================================================================
 # - copy Indexed to Sequential dropping deleted & lowkey0/highkey9 records
 exit 0

Notes

  1. This script combines 4 actions to reduce keystrokes required. - init N&A file, export filename, execute COBOL prgm, extract valid records

  2. But this script is s demo & not recommended for production. See next page for a suggested production version.

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

7H2. Micro Focus COBOL SCREEN program demo

production version of N&A entry script

 #!/bin/ksh
 # nameadrs2.ksh - script to execute Name & Address data entry
 integer JCC=0 SCC=0 LCC=0  # init step status return codes
 autoload jobset51 jobend51 jobabend51 logmsg1 logmsg2 stepctl51 exportfile
 autoload exportfile exportgen0 exportgen1 exportgenall exportgenx
 #=======
 jobset51  # call function for JCL/script initialization
 #=======
 JSTEP=S0010; ((XSTEP+=1)); SCC=0; LCC=0; alias goto="";
 #
 makeISF2 dat1/nameadrs1 255 0,10,10,30  # init file lowkey0/highkey9 records
 #=====================================    ONLY if oprtr reply 'y' at prompt
 #
 exportfile NAMEADRS dat1/nameadrs1  # export COBOL logical name to data filename
 #--------------------------
 cobrun $ANIM $CBLX/nameadrs1         # execute N&A screen data entry program
 #--------------------------
 LCC=$?; S0010C=$LCC; ((SCC+=LCC)); ((JCC+=LCC)); S0010R=1; alias goto="";
 if ((S0010C != 0))
    then logmsg2 "ERR: nameadrs2 abterm $SCC"
    alias goto="<<S9900=A"; fi
 goto
 exportgen1 +1 NAMEADRS2 dat2/nameadrs1_ # assign GDG output file for uvcp
 uvcp "fili1=$NAMEADRS,rcs=255,typ=ISF,filo1=$NAMEADRS2,typ=RST\
 ,del=0(10):0000000000,del=0(10):9999999999"
 # copy Indexed to Sequential dropping deleted, lowkey0, highkey9 records
 #8======================================================================
 S9000=A
 jobend51 #move any GDG files from jobtmp/GDG/subdirs to RUNDATA/subdirs
 logmsg2 "JobEnd=Normal"
 exit 0
 #9======================================================================
 S9900=A
 logmsg2 "ERR: Terminated Abnormally" RV ACK
 jobabend51 #report GDGs NOT moved from jobtmp/GDG/subdirs to outdirs
 exit $JCC
 #
 #          ** nameadrs2 (this script) vs nameadrs1 (prior script) **
 #
 # - nameadrs2 calls function 'jobset51' (see www.uvsoftware.ca/mvsjcl.htm#5K1)
 # - jobset51 forces 'cd $RUNDATA', means you can run from anywhere
 # - nameadrs2 outputs GDGs dat2/nameadrs1_000001, etc (vs seqntl by nameadrs1)
 # - must update ctl/gdgctl51 with name of output GDG file & generations desired
 #   (see GDG ctl file edit & load at www.uvsoftware.ca/mvsjcl.htm#5B3)
 # - GDG jobs use functions 'jobend51' & 'jobabend51' for Normal/Abnormal EOJ
 #   (save new GDG if Normal, discard new GDG if Abnormal)
 # - see GDG explanations starting at www.uvsoftware.ca/mvsjcl.htm#5D1

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

7H3. Micro Focus COBOL SCREEN program demo

Notes re production version of script

  1. This script illustrates some of the more important features of production scripts recommended by UV Software. For all recommended features, see the 'jar100.ksh' script documented at https://www.uvsoftware.ca/mvsjcl.htm#1C2.

  2. 'autoload' loads functions that may be called in the JCL/script. (jobset51, exportgen1, jobend51, jobabend51)


 #3. function 'jobset51' is called at the begining of all production scripts
     - performs 'cd $RUNDATA'. RUNDATA is defined in user profile which allows
       for testdata & proddata on the same machine or for different sets of
       testdata for different programmers or different sets of proddata for
       different operator logins.
     - defines 'CBLX=$RUNLIBS/cblx' RUNLIBS is defined in profile which allows
       for testlibs & prodlibs on the same machine or for different sets of
       testlibs for different programmers or different sets of prodlibs for
       different operator logins.
     - all without ever having to modify any JCL/scripts
  1. 'jobset51' requires the DATA subdirs be located in $RUNDATA (testdata/...), not in $RUNLIBS (testlibs/...) as shown earlier for nameadrs1.ksh


 #5. 'cobrun $ANIM $CBLX/nameadrs1'
     - '$ANIM' allows debugging/animating without having to modify JCL/script
       'export ANIM="+A" to turn animation option on
       'export ANIM=""   to turn animation option off
     - '$CBLX' defines the PATH to the COBOL executables as described in #3 above

 #6. 'LCC=$?; S0010C=$LCC' & 'if ((S0010C != 0)) ... goto S9900 ...'
     - must check return status of COBOL program executions
       & got S9900 Terminated Abnormally if not good
     - mainframe would Terminate Abnormally automatically on serious errors
       (not so on Unix/Linux systems, which is more work, but more flexible)
     - see more explanation at https://www.uvsoftware.ca/mvsjcl.htm#1C12.

 #7. function 'exportgen1' defines the 'next generation' of the nameadrs1 file
     - see GDG files documented at https://www.uvsoftware.ca/mvsjcl.htm#Part_5.
     - GDG files are identified by the trailing '_' underscore
     - actual filenames appended with 6 digit# (1st gen = nameadrs1_000001)

 #8. uvcp ...,filo1=$NAMEADRS2...
     - must use '$NAMEADRS2' to refer to the generation file defined by the
       'exportgen1' function preceding

 #9. function 'jobend51' at S9000 Normal EOJ
     - will move the new generation files from a temp subdir to output subdir

 #10. function 'jobabend51' at S9900 Normal EOJ
      - will WARN that new generation files have NOT been moved to output subdir

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

7H4. Micro Focus COBOL SCREEN program demo

nameadrs3.ksh - backup to GDG file

 #!/bin/ksh
 # nameadrs3.ksh - N&A DataEntry with option reload Indexed file from GDG backup
 integer JCC=0 SCC=0 LCC=0  # init step status return codes
 autoload jobset51 jobend51 jobabend51 logmsg1 logmsg2 stepctl51 exportfile
 autoload exportfile exportgen0 exportgen1 exportgenall exportgenx
 #=======
 jobset51  # call function for JCL/script initialization
 #=======
 JSTEP=S0010; ((XSTEP+=1)); SCC=0; LCC=0; alias goto="";
 export PROGID=nameadrs1
 #
 echo "reload N&A Indexed file from GDG backup ?"
 echo " - listing backup files to show you generation#s available"
 ls -l dat1bak
 echo "enter gen# to reload OR 0 to use current N&A file"
 read reply
 integer gen=$reply
 if [[ $gen > 0 ]]; then
    typeset -LZ6 gdg=$gen
    if [[ ! -f dat1bak/nameadrs1_$gdg ]]; then
       echo "nameadrs1_$gdg not found in dat1bak/..., job cancelled"
       exit 99; fi
 uvsort "fili1=dat1bak/nameadrs1_$gdg,typ=LST,rcs=255\
 ,filo1=dat1/nameadrs1,typ=ISF,isk1=0(10),isk2=10(30),key1=0(10)"
 fi
 exportfile NAMEADRS dat1/nameadrs1
 logmsg2 "Executing--> cobrun $ANIM $CBLX/nameadrs1"
 #3----------------------------------------------------------------------
 cobrun $ANIM $CBLX/nameadrs1
 #4----------------------------------------------------------------------
 LCC=$?; S0010C=$LCC; ((SCC+=LCC)); ((JCC+=LCC)); S0010R=1; alias goto="";
 if ((S0010C != 0))
    then logmsg2 "ERR: step#$JSTEP nameadrs1 abterm $SCC"
    alias goto="<<S9900=A"; fi
 goto
 # backup N&A file to GDG seqntl file
 exportgen1 +1 NABAK dat1bak/nameadrs1_
 uvsort "fili1=dat1/nameadrs1,typ=ISF,rcs=255,filo1=$NABAK,typ=LSTt,key1=0(10)"
 echo "N&A backed up to $NABAK"
 #8======================================================================
 S9000=A
 jobend51 #move any GDG files from jobtmp/GDG/subdirs to RUNDATA/subdirs
 logmsg2 "JobEnd=Normal, StepsExecuted=$XSTEP, LastStep=$JSTEP"
 exit 0 #jclunix51 ver:20090313 b2c0d1g1e0f1i1j0k3l20m4n3o0p0r0s0t1u1w0x0y1z0
 #9======================================================================
 S9900=A
 logmsg2 "ERR: Terminated Abnormally,JCC=$JCC,StepsX/L=$XSTEP/$JSTEP" RV ACK
 jobabend51 #report GDGs NOT moved from jobtmp/GDG/subdirs to outdirs
 exit $JCC

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

7H5. Micro Focus COBOL SCREEN program demo

nameadrs3.ksh vs nameadrs2.ksh

  1. nameadrs3.ksh (listed on prior page) backs up the N&A data entry file at the end of the job (after executing the COBOL entry/update program). The backup copies the N&A Indexed file to the next generation of a GDG sequential file (nameadrs1_000001, nameadrs1_000002, nameadrs_000003, etc).

  2. Before executing the COBOL N&A program, the script prompts the operator whether he wants to restore any 1 of the GDG files which are listed on the screen before asking for a GDG# or '0' to bypass the restore & use the existing N&A file.

  3. nameadrs2.ksh also wrote out a GDG file after the COBOL program, but that file was intended for some subsequent N&A master file update (vs intended as a backup file for possible restore).

  4. nameadrs2.ksh used 'uvcp' 'del1=...' to drop the lowkey0/highkey9 records. nameadrs3.ksh uses 'uvsort' for both the backup & restore to ensure the backup GDG files are in key seqeunce (for convenience in case you wanted to edit with vi & restore, or incase you wanted to list).

  5. You could add the uvcp extract to the nameadrs3.ksh job if desired, or you could add it to your master N&A update job. The extract drops the lowekey0/highkey9 records but your master N&A COBOL program could be easily modified to drop them.

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

7I1. Micro Focus COBOL SCREEN program demo

nameadrs2/nameadrs3 - jobset51 Requirements

The production versions (nameadrs2.ksh & nameadrs3.ksh) use 'jobset51' which provides several benefits as discussed on page '7H3', but requires that the 'data subdirs' be in $RUNDATA, not in $RUNLIBS (as for nameadrs1.ksh). The 'library subdirs' will still be in $RUNLIBS. Here are just the relevant files:

RUNLIBS - JCL/scripts & COBOL programs

 /home/userxx
 :-----:testlibs
 :     :-----cbls                <-- COBOL source programs
 :     :     :-----nameadrs1.cbl   - Name & Address demo program
 :     :     :
 :     :-----cblx                <-- compiler output subdir
 :     :     :-----nameadrs1.int   - interpretive code executed by cobrun
 :     :     :-----nameadrs1.idy   - required by debugger (animator)
 :     :     :-----nameadrs1.cbl   - copy of source required by debugger
 :     :     :
 :     :-----ctl                 <-- control files (for compiler)
 :     :     :-----cobdirectives   - COBOL Directives
 :     :     :-----extfh.cfg       - file handler configuration file
 :     :     :
 :     :-----jcls                <-- JCL/Script Files subdir
 :     :     :-----nameadrs1.ksh
 :     :     :-----nameadrs2.ksh
 :     :     :-----nameadrs3.ksh

RUNDATA - data files & GDG control file

 :     :-----ctl                 <-- control files (for compiler)
 :     :     :-----gdgctl51        - GDG control (seqntl file to be edited)
 :     :     :-----gdgctl51I.dat   - GDG control (Indexed file for exportgen1)
 :     :     :-----gdgctl51I.idx
 :     :     :
 :     :-----dat1                <-- data files subdir
 :     :     :-----nameadrs1.dat   - Name & Address Indexed file - data
 :     :     :-----nameadrs1.idx   - index partition of N&A file
 :     :     :
 :     :-----dat1bak             <-- backup subdir (GDG seqntl backup files)
 :     :     :-----nameadrs1_000001
 :     :     :-----nameadrs1_000002
 :     :     :-----nameadrs1_--etc--
 :     :     :
 :     :-----dat2                <-- subdir for extracted data
 :     :     :-----nameadrs1       - Name & Address Sequential file
 :     :     :                     - lowkey0/highkey9 & deleted records dropped
 mvslibsdirs     <-- script to setup LIBRARY subdirs in testlibs/...
 mvsdatadirs     <-- script to setup DATA subdirs in testdata/...

 copymvsctls     <-- copy control files from /home/uvadm/ctl/
 ===========         to testlibs/ctl/... & testdata/ctl/...

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

7I2. Micro Focus COBOL SCREEN program demo

updating the GDG control file

Since nameadr2.ksh & nameadrs3.ksh have GDG files, we must include their filenames in the GDG control file at $RUNDATA/ctl/gdgctl51I (.dat & .idx).

See the complete details of the GDG file implementation at JCLcnv4gdg.htm. Here is the short version:

The active GDG control file used by exportgen0,exportgen1,etc is an Indexed file for random lookup by filename, but it is much easier to prepare the contents as a text file (for easy editing).

A sample text file is provided in /home/uvadm/ctl/gdgctl51. You could use this as a guide, add your own filenames & desired generations, then load it into the Indexed GDG control file ($RUNDATA/ctl/gdgctl51I). Here is the sample file after we have added the filenames used by nameadrs3.ksh & nameadrs2.ksh.

sample GDG control file

 acme.backup.tape_                            gdg=07   job=soft0007.ksh
 gl.account.acntlist_                         gdg=07   job=jgl230.ksh
 gl.account.master_                           gdg=07   job=testx.ksh
 gl.account.trans2_                           gdg=07   job=jgl221.ksh
 gl.account.trans_                            gdg=07   job=maildemo.ksh
 gl.acnt.trans_                               gdg=07   job=ftpget1.ksh
 py.time.cards_                               gdg=07   job=jpy900.ksh
 py.timecard.edit_                            gdg=07   job=jpy300.ksh
 pytest.payroll.register_                     gdg=07   job=jpy300.ksh

loading the GDG Indexed control file

This assumes you have setup a user such as 'mvstest' with profiles,directories,& environmental variables (RUNLIBS & RUNDATA) as described in JCLcnv1demo.htm#Part_1.

If setting up your own directories (vs subdirs copied from /home/uvadm/mvstest) you could use scripts mvslibsdirs & mvsdatadirs & and use script copymvsctls to copy sample control files from /home/uvadm/ctl/. See JCLcnv1demo.htm#3D1.


 #1. login mvstest --> /home/mvstest

 #2. cd $RUNDATA  --> /home/mvstest/testdata

 #3. uvcopy gdgload1[,fili1=ctl/gdgctl51,filo1=ctl/gdgctl51I]
     ========================================================

 #3a. uvcopy gdgload1   <-- same as above (files default as shown)
      ===============

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

7I3. Micro Focus COBOL SCREEN program demo

activating console logging & retest

  1. Setup subdirs matching your userid in /home/appsadm/log1/userxx, log2/userxx, & log3/userxx as per 'ADMjobs.doc #6D1'.

  2. uncomment the 6 '##' lines at the end of your .bash_profile as per ADMjobs.htm#6C1.

  3. Logoff & back on to begin collecting the console log in a date/time stamped file in /home/appsadm/log1/userxx/yymmdd_hhmmss.


 #4. nameadrs3.ksh    <-- run the test/demo job
     =============
     --> reply '0' at prompt to inhibit restore from backup
     --> enter some N&A records
     --> enter 'q' to quit
  1. Logoff & back on. Logging off ends the profile 'script' command which collects the log & 'logfixA' is executed to process the log file from log1/userxx/... to log2/userxx/... to remove screen control characters to facilitate viewing & printing. Outputs from screen programs such as our data entry COBOL program are truncated to 1st 256 bytes. The screen displays look like garbage & we are most interested in the JCL/script displays, prompts,& operator replies.


 #6. logview  <-- run script to display log filenames (latest last #1)
     =======
     --> 1        <-- enter 1 to display contents of most recent logfile
     --> 1 -dlp1  <-- append '-dlp1' to print (assuming printer name 'lp1')

See the console log from 'nameadrs3.ksh' shown on the next page -->

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

7I4. Micro Focus COBOL SCREEN program demo

console log from nameadrs3.ksh

 Script started on Wed 09 Sep 2009 01:58:58 PM PDT
 <@:cscm:/home4/cscm> cdd
 <@:cscm:/home4/cscm/testdata> nameadrs3.ksh
 090909:135943:: Begin Job=
 090909:135943:: RUNLIBS=/home4/cscm/testlibs
 090909:135943:: RUNDATA=/home4/cscm/testdata
 090909:135943:: JTMP=/home4/cscm/testdata/jobtmp/ SYOT=/home4/cscm/testdata/sysout/
 090909:135943:: RUNDATE=20090909
 reload N&A Indexed file from GDG backup ?
  - listing backup files to show you generation#s available
 -rw-rw-r-- 1 cscm apps  719 Sep  9 10:45 nameadrs1_000001
 -rw-rw-r-- 1 cscm apps  886 Sep  9 10:53 nameadrs1_000002
 -rw-rw-r-- 1 cscm apps 1387 Sep  9 13:55 nameadrs1_000003
 enter gen# to reload OR 0 to use current N&A file
 --> 0  <-- operator reply
 090909:135947:: file: NAMEADRS=dat1/nameadrs1 bytes=2560
 090909:135947:: Executing--> cobrun -F /home4/cscm/testlibs/cblx/nameadrs1
 [m[10m[39;49m[m ** Name & Address Entry Screen **[5;4HTelephone:
 [ 0000000000 ][6;4HName:          <-- NOTE screen program control chars
 [[7;48H][8;4HAddress2:            <-- 'escape' chars removed by logfixA
 [10;15H[[10;48H][11;4HZip:[11;15H <-- output truncated by logfixA
 090909:140221:gdgget51: EOF fili01 rds=4 size=100: /home4/cscm/testdata/jobtmp//gtmp/0010O_dat1bak_nameadrs1_
 090909:140221:gdgget51: EOF filr01 rds=1 upds=1 size=16384: /home4/cscm/testdata/ctl/gdgctl51I
 090909:140221:gdgget51: EOF filo02 wrts=1 size=128: /home4/cscm/testdata/jobtmp//gtmp/0010G1_dat1bak_nameadrs1_
 090909:140221:: gen+1: NABAK=dat1bak/nameadrs1_000004 gens=10
 090909:140221:uvsort: uvsort fili1=dat1/nameadrs1,filo1=dat1bak/nameadrs1_000004
 090909:140221:uvsort: EOF fili01 11 rds, 2816 size; dat1/nameadrs1
 090909:140221:uvsort: DISAMdat: recs=11,rcsz=255,keys=2; dat1/nameadrs1
 090909:140221:uvsort: sort phase complete, used 64 megabytes, sort output begin
 090909:140221:uvsort: EOF filo01 11 wrts, 1554 size; dat1bak/nameadrs1_000004
 N&A backed up to dat1bak/nameadrs1_000004
 090909:140221:: Job Times: Begun=13:59:43 End=14:02:21 Elapsed=00:02:38
 090909:140221:gdgupok1: EOF filr01 rds=8 upds=3 size=16384: /home4/cscm/testdata/ctl/gdgctl51I
 090909:140221:: JobEnd=Normal, StepsExecuted=1, LastStep=S0010
 <@:cscm:/home4/cscm/testdata> l dat1bak
 -rw-rw-r-- 1 cscm apps  719 Sep  9 10:45 nameadrs1_000001
 -rw-rw-r-- 1 cscm apps  886 Sep  9 10:53 nameadrs1_000002
 -rw-rw-r-- 1 cscm apps 1387 Sep  9 13:55 nameadrs1_000003
 -rw-rw-r-- 1 cscm apps 1554 Sep  9 14:02 nameadrs1_000004
 <@:cscm:/home4/cscm/testdata> cat dat1bak/nameadrs1_000004
 0000000000
 2042331818TOWNSEND, JAMES SKEOCH   466 KINGSTON CR.    WINNIPEG MB R2M0T9
 4165332598TOWNSEND, DIRK           219 BEATY AVE.      TORONTO ON M6K3B3
 6047396806TOWNSEND, JILL           1035 PACIFIC BLVD   VANCOUVER BC V6E1G7
 6049805434TOWNSEND, OWEN           4667 HOSKINS RD.    NORTH VANCOUVER BC V7K2R3
 9999999999zzzzzzzzzzzzzzzzzzzzzzzzzzzzzz

<@:cscm:/home4/cscm/testdata> exit Script done on Wed 09 Sep 2009 02:03:13 PM PDT

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

Part_8 Converting Mainframe COBOL to Micro Focus COBOL

test IDXf3/IDXf8 COBOL data compatibility with 'ux' utilities


8A1. Introduction & Overview
- IDXFORMATs (1,3,8)
- test plan to prove compatibility

8A2. Environmental Variables required in your profile

8B1. Setup for IDXf3/IDXf8 compatibility tests
- setup a separate directory for testing
  (could be a subdir in your homedir)
- copy provided test files over from /home/uvadm

8C1. COBOL programs provided to test compatibility
cblidx31.cbl - load IDXf3 Indexed file from text file
cblidx32.cbl - read IDXf3 Indexed file created by 'uxcp' (uvcp if nonIndexed)
cblidx81.cbl - load IDXf8 Indexed file from text file
cblidx82.cbl - read IDXf8 Indexed file created by 'uxcp' (uvcp if nonIndexed)
cblidx83.cbl - load IDXf8 non-Indexed file from text file
cblidx84.cbl - read IDXf8 non-Indexed file created by 'uvcp'
idxf8vs1.cbl - load variable lth sequential non-indexed file
idxf8vs2.cbl - read variable lth sequential non-indexed file

8D1. Data File provided to test compatibility
idxtest - text records with key in 1st 4 & length in next 4

8E1. test IDXf3 compatibility by creating with COBOL & reading back with uxcp

8F1. test IDXf3 compatibility by creating with uxcp & reading back with COBOL

8G1. Setup for IDXf3 compatibility tests
- COBOL directives to create IDXf8 files (vs IDXf3)
- EXTFH control file for COBOL file types
- compiling COBOL programs to output IDXf8 files

8H1. test IDXf8 compatibility by creating with COBOL & reading back with uxcp

8I1. test IDXf8 compatibility by creating with uxcp & reading back with COBOL

8J1. COBOL programs to test variable length Non-Indexed
idxf8vs1.cbl - load variable lth sequential non-indexed file
idxf8vs2.cbl - read variable lth sequential non-indexed file

8J2. sample output file created by idxf8vs1.cbl COBOL program

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

8A1. test IDXf3 COBOL data file compatibility with 'ux' utilities

Micro Focus COBOL Indexed file FORMATs

IDXFORMAT1
  • FIXED length indexed files < 2 gigs
  • files have 2 parts - data & index (filename & filename.idx)
  • MF COBOL does not use filename.dat & filename.idx (like C-ISAM)
  • compatible with C-ISAM & D_ISAM (used by 'uv' utilities)
  • 'uv' utilities provided to process IDXFORMAT1 files
IDXFORMAT3
  • VARIABLE length indexed files < 2 gigs
  • files have 2 parts - data & index (filename & filename.idx)
  • 'ux' utilities provided to process IDXFORMAT3 files
IDXFORMAT8
  • FIXED & VARIABLE length indexed files > 2 gigs
  • files have only 1 part - data & index in same partition
  • 'ux' utilities (with option y2) provided for IDXFORMAT8 files

'uv' utilities

The 'uv' utilities (uvcp,uvsort,uvcopy,uvqrpg) can process IDXFORMAT1 files (& any non-indexed file). The 'uv' utilities use the D-ISAM file handler which is compatible with Micro Focus COBOL IDXFORMAT1.

'ux' utilities

The 'ux' utilities (uxcp,uxsort,uxcopy,uxqrpg) can process IDXFORMAT3/8 files (in addition to IDXFORMAT1 & any non-indexed file). The 'ux' utilities must be compiled using the Micro Focus compiler to include the file handler for IDXFORMAT3 & IDXFORMAT8. See the special compile instructions on page D1 of install.htm#D1.

testing IDXf3 compatibility between MF COBOL & uxcp

We will test compatibility by creating an IDXf3 file with 'COBOL' & reading back with 'uxcp'. We will test the reverse by creating an IDXf3 file with 'uxcp' & reading back with 'COBOL'.

Text file 'idxtest' is provided as input to these tests. It has the indexed key in the 1st 4 bytes & the desired record length in the next 4 bytes. COBOL program 'cblidx31' will load the IDXf3 file & 'cblidx32' will read it.

create IDXf3 with COBOL & readback with uxcp

 dat1/idxtest --------------> dat2/idxf3Icbl -------------> dat3/idxf3Luxcp
               cblidx31                         uxcp

create IDXf3 with uxcp & readback with COBOL

 dat1/idxtest ------------> dat2/idxf3Iux -----------------> dat3/idxf3Lcbl
               uxcp                           cblidx32

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

8A2. test IDXf3 COBOL data file compatibility with 'ux' utilities

profile requirements

You must have setup your profile as mentioned on pages '5A1' thru 5A3 & listed at ADMjobs.htm#1B2.

The following lines (126,152,153) from the common_profile are especially relevant to using uxcp with indexed files & compiling COBOL programs using file formats IDXFORMAT3 & IDXFORMAT8.


 export ISDATEXT=".dat"                   # .dat ext for uvsort,uvcopy,uvcp,etc
 ======================
 export COBOPT=$RUNLIBS/ctl/cobdirectives # compiler options & Directives
 ========================================
 export EXTFH=$RUNLIBS/ctl/extfh.cfg      # file handler configuration
 ===================================

Note that RUNLIBS must be the superdir in which you are testing & which contains the 'ctl' subdir. RUNLIBS is defined on line 52 of the stub_profile listed at ADMjobs.htm#1C2.

Note the profile setup instructions directed you to copy/rename the stub_profile to .profile in your homedir (or .bash_profile for bash users).


 export RUNLIBS=$HOME
 ====================

If you make subdir 'uxcbltest' within your home dir, you must change as follows:


 export RUNLIBS=$HOME/uxcbltest
 ==============================

Indexed file Extensions

Note that 'IDXNAMETYPE=2' in extfh.cfg appends '.dat' on the data partition of indexed files. See extfh.cfg listed on page '8G3'.

'.idx' is always present on the index partition of IDXFORMAT1 & IDXFORMAT3. Note that there is no separate index partition for IDXFORMAT8 files.

Note that for COBOL (or uxcp,uxsort,uxcopy) you specify only the base filename. The .dat (& .idx) is assumed.

You would specify the '.dat' for utilities such as 'uvhd' which do not contain the Micro Focus COBOL file handler (that assumes .dat/.idx).

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

8B1. test IDXf3 COBOL data file compatibility with 'ux' utilities

Setup for testing ux/COBOL compatibility

Setup a separate directory for testing (could be a subdir in your homedir).

  1. login --> to your homedir


 2a. mkdir uxcbltest              <-- make directory for testing
     ===============
 2b. cd uxcbltest                 <-- change into the directory
     ============
  1. Make subdirs required:


 3a. mkdir cbls cblst cblx cpys ctl dat1 dat2 dat3 tmp
     =================================================

 3b. uxcbltestdirs         - OR run script provided to make subdirs
     =============
  1. copy the COBOL directives & file configuration files to 'ctl' subdir


 4a. cp /home/uvadm/ctl/cobdirectives ctl
     ====================================
 4b. cp /home/uvadm/ctl/extfh.cfg ctl
     ================================
  1. Copy the test data file provided (from uvadm)


 5a. cp /home/uvadm/dat1/idxtest dat1
     ================================
  1. Copy the test COBOL programs provided (from uvadm)


 6a. cp /home/uvadm/mf/cbls/cblidx31.cbl cbls   # loads IDXf3 from text file
     ========================================

 6b. cp /home/uvadm/mf/cbls/cblidx32.cbl cbls   # reads IDXf3, writes text
     ========================================
  1. Compile the COBOL programs:


 7a. mfcbl1 cblidx31.cbl <-- compile program to load IDXf3 files (from text file)
     ===================

 7b. mfcbl1 cblidx32.cbl <-- compile program to read IDXf3 files (write text file)
     ===================

See test procedures further ahead, after we list the COBOL programs & the test input data file.

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

8C1. test IDXf3 COBOL data file compatibility with 'ux' utilities

COBOL program to load IDXf3 file

       $SET IDXFORMAT(3)
        identification division.
       * cblidx31 - test IDXFORMAT3 Variable length Indexed files
       * - load a variable length ISAM file (record-size < 4K)
       * - input records have key in 1st 4 bytes & length in next 4
       * compile & run the .int program without JCL as follows:
       * 1.  cd /home/uvadm           #subdirs: cbls, cblx, dat1, tmp1
       * 2.  mkdir cblx tmp1          #make output subdir if not present
       * 3.  mfcbl1 cblidx31.cbl      #compile program (output in cblx)
       * 4a. export FILE1=dat1/idxfL  #declare input file
       * 4b. export FILE2=tmp1/idxf3v #declare output file
       * 5.  cobrun cblx/cblidx31     #execute program
        program-id. cblidx31.
        environment division.
        input-output section.
        file-control.
            select filein assign external file1
                   organization is line sequential.
            select fileout assign external file2
                   organization is indexed
                   access is sequential
                   record key is outreckey.
        data  division.
        file section.
        fd  filein record contains 500 characters.
            01 filein-rec.
               05 inreckey        pic  x(4).
               05 filler          pic  x.
               05 inrecsize       pic  9(4).
               05 inrecdata       pic  x(491).
        fd  fileout record varying from 50 to 400 depending on recsize.
            01 fileout-rec.
               05 outreckey        pic  x(4).
               05 filler           pic  x.
               05 outrecsize       pic  9(4).
               05 outrecdata       pic  x(391).
        working-storage section.
        01  filein-eof             pic  x value ' '.
        01  recsize                pic  9(4).
        procedure division.
        mainline.
            open input filein.  open output fileout.
            move spaces to filein-rec.
            read filein at end move '1' to filein-eof.
            perform dtlrtn until filein-eof = '1'.
            close filein fileout. stop run.
        dtlrtn.
            move spaces to fileout-rec.
            move filein-rec to fileout-rec.
            move inrecsize to outrecsize. move inrecsize to recsize.
            write fileout-rec.  move spaces to filein-rec.
            read filein at end move '1' to filein-eof.

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

8C2. test IDXf3 COBOL data file compatibility with 'ux' utilities

COBOL program to read IDXf3 file

       $SET IDXFORMAT(3)
        identification division.
       * cblidx32 - test IDXFORMAT3 Variable length Indexed files
       * - reads a variable length ISAM file (record-size < 4K)
       * - writes output to a text file (Line Sequential)
       * compile & run the .int program without JCL as follows:
       * 1.  cd /home/uvadm           #subdirs: cbls, cblx, dat1, tmp
       * 2.  mkdir cblx               #make output subdir if not present
       * 3.  mfcbl1 cblidx32.cbl      #compile program (output in cblx)
       * 4a. export FILE1=tmp/idx3I   #declare input file
       * 4b. export FILE2=tmp/idx3S   #declare output file
       * 5.  cobrun cobx/cblidx32     #execute program
        program-id. cblidx32.
        environment division.
        input-output section.
        file-control.
            select filein assign external file1
                   organization is indexed
                   record key is inreckey
                   access is sequential.
            select fileout assign external file2
                   organization is line sequential.
        data  division.
        file section.
        fd  filein record contains 8 to 500 characters
            recording mode is v.
            01 filein-rec.
               05 inreckey         pic  x(4).
               05 inrecdata        pic  x(496).
        fd  fileout record 500 characters.
            01 fileout-rec         pic  x(500).
        working-storage section.
        01  filein-eof             pic  x value ' '.
        01  recsize                pic  9(4).
       *
        procedure division.
        mainline.
            open input filein.
            open output fileout.
            move spaces to filein-rec.
            read filein at end move '1' to filein-eof.
            perform dtlrtn until filein-eof = '1'.
            close filein fileout. stop run.
        dtlrtn.
            move spaces to fileout-rec.
            move filein-rec to fileout-rec.
            write fileout-rec.
            move spaces to filein-rec.
            read filein at end move '1' to filein-eof.

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

8D1. test IDXf3 COBOL data file compatibility with 'ux' utilities

data file provided to test IDXf3

 0010.0060 idxtest text file to create Var Lth Indexed files.
 0020.0064 - input to COBOL,uxcp,uxcopy to create IDXf1,3,8 files
 0030.0065 - 01-04=ISAM key, 05=separator, 06-09=size, 10-400 text
 0040.0067 - output record varies from 64 to 256, depending on 06-09
 0050.0080 - here is an 80 byte record------------------------------------------>
 0060.0160 - here is a 160 byte record...........................................
 0070.0240 - here is a 240 byte record (last record in file).....................
 ===============================================================================>

NOTES

The indexed key is in the 1st 4 columns & columns 6-9 specify the record length to be written by the COBOL test programs.

uxcp automatically determines the record length by scanning back to the last non-blank of the input & rounding up to a multiple of 4.

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

8E1. test IDXf3 compatibility by creating with COBOL & reading back wi th uxcp

create IDXf3 with COBOL & readback with uxcp

 dat1/idxtest --------------> dat2/idxf3Icbl -------------> dat3/idxf3Luxcp
               cblidx31                         uxcp

 #1. Execute COBOL program to create IDXf3 file

 #1a. export FILE1=dat1/idxtest        <-- specify input file
      =========================

 #1b. export FILE2=dat2/idxf3Icbl       <-- specify output file
      ==========================

 #1c. cobrun cblx/cblidx31              <-- execute COBOL program
      ====================

 #2. Read the COBOL IDXf3 file with 'uxcp' (test compatibility)

 #2a. uxcp "fili1=dat2/idxf3Icbl,typ=IDXf3,rcs=256,filo1=dat3/idxf3Lux,typ=LSTt"
      ==========================================================================
Note
  • if you get open status 9/- (57/13) file not found
  • might be file extension conflict '.dat' or null for data partition
  • controlled by 'IDXNAMETYPE=2' in $UV/ctl/idxfh.cfg control file
  • could also use 'uvcp' (vs uxcp) & typ=RSV (vs typ=IDXf3)
    if .dat present & if input file non-Indexed

 #2b. uvcp "fili1=dat2/idxf3Icbl.dat,typ=RSV,rcs=256,filo1=dat3/idxf3Lux,typ=LSTt"
      ============================================================================

 #3.  Alternative to #2a - use following script:

 #3a. uxcpIDXf3-LST      <-- script alternative (same code as above)
      =============

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

8E2. test IDXf3 compatibility, create with COBOL, read back with uxcp


 #4. Check results - output should be the same as original input.
     See original input file listing on page 'D1'

 #4a. cat dat3/idxf3Luxcp
      ===================
 0010.0060 idxtest text file to create Var Lth Indexed files.
 0020.0064 - input to COBOL,uxcp,uxcopy to create IDXf1,3,8 files
 0030.0065 - 01-04=ISAM key, 05=separator, 06-09=size, 10-400 text
 0040.0067 - output record varies from 64 to 256, depending on 06-09
 0050.0080 - here is an 80 byte record------------------------------------------>
 0060.0160 - here is a 160 byte record...........................................
 0070.0240 - here is a 240 byte record (last record in file).....................
 ===============================================================================>

 #5. diff dat1/idxtest dat3/idxf3Luxcp
     =================================
     - verify that result is same as original input file
       (result of converting to IDXf3 by COBOL & back to LST by uxcp)

 #6. Check the IDXf3 file created by COBOL
     - must use uvhd, see next page ----->

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

8E3. test IDXf3 compatibility, create with COBOL, read back with uxcp

using uvhd to check IDXf3 file created by COBOL

We must use 'uvhd' to investigate the IDXf3 file, since it contains binary. Note that option 'v' is required to interpret the IDXf3 format. This will show the file control record & the data records (with each data record starting in a new block display). You could use uvhd without option 'v' which simply displays each 256 byte block without regard to record boundaries.


 uvhd dat2/idxf3Icbl.dat v        <-- display IDXf3 file (created by COBOL)
 ========================
                      10        20        30        40        50        60
 r#        1 0123456789012345678901234567890123456789012345678901234567890123
           0 0~......0801141147122208011411471222.>.......................2..
             3700000033333333333333333333333333330300000000000000000009000300
             0E00000008011411471222080114114712220E02000000001000000010000200
          64 ............................................X"8*................
             0000000000000000000000000000000000000000000052320000000000000000
             00000000000020100000000000000000000000000000828A0000000000000000
                      10        20        30        40        50        60
 r#        2 0123456789012345678901234567890123456789012345678901234567890123
         532 @<0010.0060 idxtest text file to create Var Lth Indexed files...
             4333332333326677677276772666627626766762567247624666766266667200
             0C0010E00600948453404584069C504F032514506120C4809E45854069C53E00
                      10        20        30        40        50        60
 r#        3 0123456789012345678901234567890123456789012345678901234567890123
         596 @@0020.0064 - input to COBOL,uxcp,uxcopy to create IDXf1,3,8 fil
             4433332333322266777276244444277672776677276267667624456323232666
             000020E00640D09E05404F03F2FCC5830C583F0904F0325145094861C3C8069C
          64 es..
             6700
             5300
                      10        20        30        40        50        60
 r#        4 0123456789012345678901234567890123456789012345678901234567890123
         664 @A0030.0065 - 01-04=ISAM key, 05=separator, 06-09=size, 10-400 t
             4433332333322233233345442667223337676767672233233376762233233327
             010030E00650D001D04D931D0B59C005D3501214F2C006D09D39A5C010D40004
          64 ext.
             6770
             5840
                      10        20        30        40        50        60
 r#        5 0123456789012345678901234567890123456789012345678901234567890123
         732 @C0040.0067 - output record varies from 64 to 256, depending on
             4433332333322267777727666762767667267662332762333226676666662662
             030040E00670D0F540540253F240612953062FD06404F0256C04505E49E70FE0
          64 06-09...
             33233000
             06D09000

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

idxf3Icbl COBOL IDXFORMAT3 file continued

                      10        20        30        40        50        60
 r#        6 0123456789012345678901234567890123456789012345678901234567890123
         804 @P0050.0080 - here is an 80 byte record-------------------------
             4533332333322266762672662332677627666762222222222222222222222222
             000050E00800D0852509301E080029450253F24DDDDDDDDDDDDDDDDDDDDDDDDD
          64 ----------------->..
             22222222222222222300
             DDDDDDDDDDDDDDDDDE00
                      10        20        30        40        50        60
 r#        7 0123456789012345678901234567890123456789012345678901234567890123
         888 @.0060.0160 - here is a 160 byte record.........................
             4A33332333322266762672623332677627666762222222222222222222222222
             000060E01600D08525093010160029450253F24EEEEEEEEEEEEEEEEEEEEEEEEE
          64 ..................----------------------------------------------
             2222222222222222222222222222222222222222222222222222222222222222
             EEEEEEEEEEEEEEEEEEDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD
         128 --------------------------------->..
             222222222222222222222222222222222300
             DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDE00
                      10        20        30        40        50        60
 r#        8 0123456789012345678901234567890123456789012345678901234567890123
        1052 @.0070.0240 - here is a 240 byte record (last record in file)...
             4F33332333322266762672623332677627666762266772766676266266662222
             000070E02400D08525093010240029450253F2408C1340253F2409E069C59EEE
          64 ..................----------------------------------------------
             2222222222222222222222222222222222222222222222222222222222222222
             EEEEEEEEEEEEEEEEEEDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD
         128 --------------------------------->==============================
             2222222222222222222222222222222223333333333333333333333333333333
             DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDEDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD
         192 =================================================>..
             3333333333333333333333333333333333333333333333333300
             DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDE00

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

8F1. test IDXf3 compatibility by creating with uxcp & reading back wit h COBOL

create IDXf3 with uxcp & readback with COBOL

 dat1/idxtest ------------> dat2/idxf3Iux -----------------> dat3/idxf3Lcbl
               uxcp                           cblidx32
  1. use 'uxcp' to create IDXf3 file for readback with COBOL (test compatibility)


 1a. uxcp "fili1=dat1/idxtest,typ=LST,rcs=256,filo1=dat2/idxf3Iux,typ=IDXf3v60y4,isk1=0(4)"
 ================================================================================
     - OR use following script:

 1b. uxcpLST-IDXf3              <-- script alternative (same code as above)
     =============
  1. Execute COBOL program to readback the IDXf3 file created by uxcp


 2a. export FILE1=dat2/idxf3Iux    <-- specify input file
     ==========================

 2b. export FILE2=dat3/idxf3Lcbl     <-- specify output file
     ===========================

 2c. cobrun cblx/cblidx32           <-- execute COBOL program
     ====================
  1. Check results - output should be the same as original input. See original input file listing on page 'D1'


 3a. cat dat3/idxf3Lcbl
     ==================
 0010.0060 idxtest text file to create Var Lth Indexed files.
 0020.0064 - input to COBOL,uxcp,uxcopy to create IDXf1,3,8 files
 0030.0065 - 01-04=ISAM key, 05=separator, 06-09=size, 10-400 text
 0040.0067 - output record varies from 64 to 256, depending on 06-09
 0050.0080 - here is an 80 byte record------------------------------------------>
 0060.0160 - here is a 160 byte record...........................................
 0070.0240 - here is a 240 byte record (last record in file).....................
 ===============================================================================>

 4. diff dat1/idxtest dat3/idxf3Lcbl
    ================================
    - verify that result is same as original input file
      (result of converting to IDXf3 by uxcp & back to LST by COBOL)
  1. Check the IDXf3 file created by uxcp - must use uvhd, see next page ----->

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

8F2. test IDXf3 compatibility by creating with uxcp & reading back wit h COBOL

using uvhd to check IDXf3 file created by uxcp

We must use 'uvhd' to investigate the IDXf3 file, since it contains binary. Note that option 'v' is required to interpret the IDXf3 format. This will show the file control record & the data records (with each data record starting in a new block display). You could use uvhd without option 'v' which simply displays each 256 byte block without regard to record boundaries.


 uvhd dat2/idxf3Iux.dat v        <-- display IDXf3 file (created by uxcp)
 ========================
                      10        20        30        40        50        60
 r#        1 0123456789012345678901234567890123456789012345678901234567890123
           0 0~......0801141148149308011411481493.>.......................<..
             3700000033333333333333333333333333330300000000000000000000000300
             0E00000008011411481493080114114814930E02000000001000000010000C00
          64 ............................................X"8*................
             0000000000000000000000000000000000000000000052320000000000000000
             00000000000020100000000000000000000000000000828A0000000000000000
                      10        20        30        40        50        60
 r#        2 0123456789012345678901234567890123456789012345678901234567890123
         388 @<0010.0060 idxtest text file to create Var Lth Indexed files...
             4333332333326677677276772666627626766762567247624666766266667200
             0C0010E00600948453404584069C504F032514506120C4809E45854069C53E00
                      10        20        30        40        50        60
 r#        3 0123456789012345678901234567890123456789012345678901234567890123
         452 @@0020.0064 - input to COBOL,uxcp,uxcopy to create IDXf1,3,8 fil
             4433332333322266777276244444277672776677276267667624456323232666
             000020E00640D09E05404F03F2FCC5830C583F0904F0325145094861C3C8069C
          64 es..
             6700
             5300
                      10        20        30        40        50        60
 r#        4 0123456789012345678901234567890123456789012345678901234567890123
         520 @A0030.0065 - 01-04=ISAM key, 05=separator, 06-09=size, 10-400 t
             4433332333322233233345442667223337676767672233233376762233233327
             010030E00650D001D04D931D0B59C005D3501214F2C006D09D39A5C010D40004
          64 ext.
             6770
             5840
                      10        20        30        40        50        60
 r#        5 0123456789012345678901234567890123456789012345678901234567890123
         588 @C0040.0067 - output record varies from 64 to 256, depending on
             4433332333322267777727666762767667267662332762333226676666662662
             030040E00670D0F540540253F240612953062FD06404F0256C04505E49E70FE0
          64 06-09...
             33233000
             06D09000
              - - - remainder of file omitted (to fit on 1 page) - - -
                   - - - similar to COBOL file on page '8E2' - - -

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

8G1. setup to test IDXf8 compatibility between COBOL & 'ux' utilities

COBOL Directive to create IDXFORMAT8 files

To test IDXf8 files, we need to compile the programs with the 'IDXFORMAT(8)' directive active. We could add it to the ctl/cobdirectives COBOL options file or we could add it as a $SET statement in only those COBOL programs desired. We have chosen to specify on a $SET stmnt on the 1st line of cblidx81/82


       $SET IDXFORMAT(8)
       =================

Otherwise the cblidx81/82 programs are the same as the cblidx31/32 programs. Having different program & data file names avoids overwriting our IDXf3 results & clarifies the following documentation.

The COBOL DIRECTIVES file is listed on the next page, in case you wish to specify IDXFORMAT(8) there to force all indexed output files to be created as IDXFORMAT8

The compile scripts (mfcbl1 & mfcblA) specify the COBOL options file via:


 export COBOPT=$RUNLIBS/ctl/cobdirectives
 ========================================

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

8G2. setup to test IDXf8 compatibility between COBOL & 'ux' utilities

ctl/directives file

 # cobdirectives - Directives for Micro Focus COBOL Server Express (Unix/Linux)
 #               - for batch compile of COBOL programs migrated from mainframe
 # - see more at www.uvsoftware.ca/mvscobol.htm#Part_5
 # - this file defined in compile scripts mfcbl1 & mfcblA as follows:
 #
 # export COBOPT=$(PWD)/ctl/cobdirectives   <-- if file exists
 # ======================================
 # export COBOPT=$UV/ctl/cobdirectives      <--else this
 # ======================================
 # choose 1 of: ANS85, COBOL370, OSVS, VSC2
 # -C ANS85
 # -C VSC2(2)
 -C ENTCOBOL
 -C CASE
 -C IBMCOMP
 -C INDD(SYSIN)
 -C OUTDD(SYSOUT)
 -C LIST()
 -C FORM(56)
 -C PERFORM-TYPE(OSVS)
 -C NOSEG
 -C SIGN(ASCII)
 -C SOURCEFORMAT(FIXED)
 -C NOMFCOMMENT
 -C SPZERO
 -C NOCHECKNUM
 # -C FILESHARE
 # -C NOODOSLIDE
 # -C EARLY-RELEASE
 # -C HOST-NUMMOVE
 # -C HOST-NUMCOMPARE
 #
 #                       ** Database Directives **
 #           (uncomment 1 of the following & modify as required)
 #
 # -C SQL(dbman==ODBC)
 -C SQL(dbman==ODBC,TARGETDB==MSSQLSERVER)
 #  --> above works, but following gives error "1507U illegal command line"
 # -C SQL(dbman==ODBC,TARGETDB==MSSQLSERVER,BEHAVIOUR==ANSI)
 # -C SQL(dbman==ODBC,TARGETDB==MSSQLSERVER,BEHAVIOUR==MAINFRAME,DIALECT==MAINFRAME,NOCHECK)
 #
 # -C SQL(targetdb==ORACLEOCI)
 # -C "DB2(init==prot db==ar)"
 # -C "preprocess(cobsql) cobsqltype==ORACLE8 end-c comp5==yes endp"
 #
 #  Use "preprocess(cobsql) ... to invoke ORACLE PRO*COBOL automatically
 #  Better than running procobol separately prior to compile
 #  animation then shows EXEC SQL stmts (vs many generated lines)
 #  (NO directive required if calling ProCOBOL separately before compiler)
 #
 #  OpenESQL targetdb= alternatives to above "preprocess(cobsql) ..."
 #  could be DB2,INFORMIX,MSQLSERVER,SYBASE (not MySQL)

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

8G3. setup to test IDXf8 compatibility between COBOL & 'ux' utilities

ctl/extfh.cfg file

 # extfh.cfg - File Handler Configuration file for Micro Focus COBOL
 # - see https://supportline.microfocus.com/Documentation/books/sx40sp/fh...
 # - see www.uvsoftware.ca/mvscobol.htm#5D2 & www.uvsoftware.ca/vsecobol.htm#5D2
 #
 # Location of this file defined by variable EXTFH in compile scripts as follows:
 #   export EXTFH=$UV/ctl/extfh.cfg    # COBOL File Handler Configuration
 #   ==============================
 #   export UV=/home/uvadm             # UV default definition in common_profile
 # See compile scripts mfcbl1 & mfcblA in $UV/sf/IBM/mfcbl1 & mfcblA
 #
 # Compile scripts also define location of COBOL directives as follows:
 #   export COBOPT=$UV/ctl/cobdirectives  # directives (-C options)
 #---------------------------------------------------------------------------
 # [XFH-DEFAULT]      - following options apply to all files
 #                    - unless over-ridden by [INTERNAL:EXTNAME] (see below)
 #
 #  IDXFORMAT=1       - create all indexed files as IDX1 (fixed lth < 2 gig)
 #  IDXFORMAT=8       - create all indexed files as IDX8 (allows > 2 gig)
 #    default         - IDXFORMAT unspecified would create fixed lth IDXFORMAT1,
 #                      & variable length as IDXFORMAT3 ? or IDXFORMAT8 ?
 #  $SET IDXFORMAT(3) - alternative way to set IDXFORMAT
 #                    - insert $SET IDX... in COBOL source ('$' in col 7)
 #
 #  IDXNAMETYPE=2     - means data partitions have '.dat' extension
 #                    - index partitions always have '.idx' extension
 #                    - IDXFORMAT=8 files have only 1 partition
 #                      & it will have '.dat' extension if IDXNAMETYPE=2
 #                      & does include the indexes (in spite of its name)
 #
 #  FILEMAXSIZE=4     - 4 byte offsets restricts files to 2 gigs
 #                    - might need 4 byte offsets for compatibility
 #  FILEMAXSIZE=8     - 8 byte offsets file size gargantuan
 #  FILEPOINTERSIZE=8 - allow IDX8 files > 256 Terrabytes (dont need)
 #---------------------------------------------------------------------------
 [XFH-DEFAULT]
 IDXFORMAT=1
 IDXNAMETYPE=2
 FILEMAXSIZE=8
 #
 #---------------------------------------------------------------------------
 #  -- OR -- you can assign characteristics to individual files as follows:
 # [INTERNAL:EXTNAME] - following options apply to a specific file ID by EXTNAME
 #                      on: 'select cobolFDname assign external EXTNAME'
 #                    - applies only to file defined by EXTNAME matching env-var
 #                      export EXTNAME=pathname (in JCL/script prior to cobrun)
 #                                 - - - examples - - -
 # [INTERNAL:E212853] - example for file whose EXTNAME=E212853 (select external)
 #  IDXFORMAT=1       - force IDXFORMAT1 vs any [XFH-DEFAULT] IDXFORMAT_
 # [INTERNAL:E212002] - example for file whose EXTNAME=E212002 (select external)
 #  IDXFORMAT=8       - force IDXFORMAT8 vs any [XFH-DEFAULT] IDXFORMAT_
 #---------------------------------------------------------------------------

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

8G4. setup to test IDXf8 compatibility between COBOL & 'ux' utilities

setup to test IDXf8 compatibility

Note
  • The setup is similar to page '8B1' (for IDXf3)
  • only the modified steps are shown here
  • other setups are common to both IDXf3 & IDXf8
  1. Copy the test data file provided (from uvadm)


 4a. cp /home/uvadm/dat1/idxtest dat1
     ================================
  1. Copy the test COBOL programs provided (from uvadm)


 5a. cp /home/uvadm/mf/cbls/cblidx81.cbl cbls   # loads IDXf3 from text file
     ========================================

 5b. cp /home/uvadm/mf/cbls/cblidx82.cbl cbls   # reads IDXf3, writes text
     ========================================

compile the IDXf8 COBOL test programs

  1. Compile the COBOL programs:


 6a. mfcbl1 cblidx81.cbl <-- compile program to load IDXf8 files (from text file)
     ===================

 6b. mfcbl1 cblidx82.cbl <-- compile program to read IDXf8 files (write text file)
     ===================
Note
  • test programs cblidx81/82 are the same as cblidx31/32
    except for the '$SET IDXFORMAT(8)'
  • Different programs with different filenames avoids overwriting previous
    IDXf3 results & clarifies the following operating instructions

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

8H1. test IDXf8 compatibility by creating with COBOL & reading back wi th uxcp

create IDXf8 with COBOL & readback with uxcp

 dat1/idxtest --------------> dat2/idxf8Icbl -------------> dat3/idxf8Luxcp
               cblidx81                         uxcp
  1. Execute COBOL program to create IDXf8 file


 1a. export FILE1=dat1/idxtest      <-- specify input file
     =========================

 1b. export FILE2=dat2/idxf8Icbl     <-- specify output file
     ==========================

 1c. cobrun cblx/cblidx81           <-- execute COBOL program
     ====================
  1. Read the COBOL IDXf8 file with 'uxcp' (test compatibility)


 2a. uxcp "fili1=dat2/idxf8Icbl,typ=IDXf8,rcs=256,filo1=dat3/idxf8Lux,typ=LSTt"
     ==========================================================================
     - OR use following script:

 2b. uxcpIDXf8-LST              <-- script alternative (same code as above)
     =============
  1. Check results - output should be the same as original input. See original input file listing on page 'D1'


 3a. cat dat3/idxf8Luxcp
     ===================
 0010.0060 idxtest text file to create Var Lth Indexed files.
 0020.0064 - input to COBOL,uxcp,uxcopy to create IDXf1,3,8 files
 0030.0065 - 01-04=ISAM key, 05=separator, 06-09=size, 10-400 text
 0040.0067 - output record varies from 64 to 256, depending on 06-09
 0050.0080 - here is an 80 byte record------------------------------------------>
 0060.0160 - here is a 160 byte record...........................................
 0070.0240 - here is a 240 byte record (last record in file).....................
 ===============================================================================>

 4. diff dat1/idxtest dat3/idxf8Luxcp
    =================================
    - verify that result is same as original input file
      (result of converting to IDXf8 by COBOL & back to LST by uxcp)
  1. Check the IDXf8 file created by COBOL - must use uvhd, see next page ----->

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

8H2. test IDXf8 compatibility, create with COBOL, read back with uxc p

using uvhd to check IDXf8 file created by COBOL

We must use 'uvhd' to investigate the IDXf8 file, since it contains binary. Note that option 'v' is required to interpret the IDXf8 format. This will show the file control record & the data records (with each data record starting in a new block display). You could use uvhd without option 'v' which simply displays each 256 byte block without regard to record boundaries.


 uvhd dat2/idxf8Icbl.dat v        <-- display IDXf8 file (created by COBOL)
 =========================          - need option 'v' for IDXf8 or IDXF3 files
                      10        20        30        40        50        60
 r#        1 0123456789012345678901234567890123456789012345678901234567890123
           0 3.......0801141138321108011411383211.>.......................2..
             3F00000033333333333333333333333333330300000000000000000009000300
             3E00000008011411383211080114113832110E02001800001060000010000200
          64 ............................................X"8*X"8*............
             000000000000000000000000000000000000000000005232523200000000001A
             00000007000022100000000000000000000000000008828A828A000000000008
         128 ................................................................
             0000001A000000000000000000000000000000000000000F0000000000000000
             000000084244010400000040000000C0000000000000003E0000000000000000
               - - - remainder of header deleted (all x'00's to 1024 - - -
                      10        20        30        40        50        60
 r#        2 0123456789012345678901234567890123456789012345678901234567890123
        3480 @<0010.0060 idxtest text file to create Var Lth Indexed files...
             4333332333326677677276772666627626766762567247624666766266667200
             0C0010E00600948453404584069C504F032514506120C4809E45854069C53E00
                      10        20        30        40        50        60
 r#        3 0123456789012345678901234567890123456789012345678901234567890123
        3544 @@0020.0064 - input to COBOL,uxcp,uxcopy to create IDXf1,3,8 fil
             4433332333322266777276244444277672776677276267667624456323232666
             000020E00640D09E05404F03F2FCC5830C583F0904F0325145094861C3C8069C
          64 es..
             6700
             5300
                      10        20        30        40        50        60
 r#        4 0123456789012345678901234567890123456789012345678901234567890123
        3616 @A0030.0065 - 01-04=ISAM key, 05=separator, 06-09=size, 10-400 t
             4433332333322233233345442667223337676767672233233376762233233327
             010030E00650D001D04D931D0B59C005D3501214F2C006D09D39A5C010D40004
          64 ext.
             6770
             5840

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

idxf8Icbl COBOL IDXFORMAT8 file continued

                      10        20        30        40        50        60
 r#        5 0123456789012345678901234567890123456789012345678901234567890123
        3688 @C0040.0067 - output record varies from 64 to 256, depending on
             4433332333322267777727666762767667267662332762333226676666662662
             030040E00670D0F540540253F240612953062FD06404F0256C04505E49E70FE0
          64 06-09...
             33233000
             06D09000
                      10        20        30        40        50        60
 r#        6 0123456789012345678901234567890123456789012345678901234567890123
        3760 @P0050.0080 - here is an 80 byte record-------------------------
             4533332333322266762672662332677627666762222222222222222222222222
             000050E00800D0852509301E080029450253F24DDDDDDDDDDDDDDDDDDDDDDDDD
          64 ----------------->..
             22222222222222222300
             DDDDDDDDDDDDDDDDDE00
                      10        20        30        40        50        60
 r#        7 0123456789012345678901234567890123456789012345678901234567890123
        3848 @.0060.0160 - here is a 160 byte record.........................
             4A33332333322266762672623332677627666762222222222222222222222222
             000060E01600D08525093010160029450253F24EEEEEEEEEEEEEEEEEEEEEEEEE
          64 ..................----------------------------------------------
             2222222222222222222222222222222222222222222222222222222222222222
             EEEEEEEEEEEEEEEEEEDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD
         128 --------------------------------->..
             222222222222222222222222222222222300
             DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDE00
                      10        20        30        40        50        60
 r#        8 0123456789012345678901234567890123456789012345678901234567890123
        4016 @.0070.0240 - here is a 240 byte record (last record in file)...
             4F33332333322266762672623332677627666762266772766676266266662222
             000070E02400D08525093010240029450253F2408C1340253F2409E069C59EEE
          64 ..................----------------------------------------------
             2222222222222222222222222222222222222222222222222222222222222222
             EEEEEEEEEEEEEEEEEEDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD
         128 --------------------------------->==============================
             2222222222222222222222222222222223333333333333333333333333333333
             DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDEDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD
         192 =================================================>..
             3333333333333333333333333333333333333333333333333300
             DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDE00

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

8I1. test IDXf8 compatibility by creating with uxcp & reading back wit h COBOL

create IDXf8 with uxcp & readback with COBOL

 dat1/idxtest ------------> dat2/idxf8Iux -----------------> dat3/idxf8Lcbl
               uxcp                           cblidx82
  1. use 'uxcp' to create IDXf8 file for readback with COBOL (test compatibility)


 1a. uxcp "fili1=dat1/idxtest,typ=LST,rcs=256,filo1=dat2/idxf8Iux,typ=IDXf8v60y4,isk1=0(4)"
 ================================================================================
     - OR use following script:

 1b. uxcpLST-IDXf8              <-- script alternative (same code as above)
     =============
  1. Execute COBOL program to readback the IDXf8 file created by uxcp


 2a. export FILE1=dat2/idxf8Iux    <-- specify input file
     ==========================

 2b. export FILE2=dat3/idxf8Lcbl     <-- specify output file
     ===========================

 2c. cobrun cblx/cblidx82           <-- execute COBOL program
     ====================
  1. Check results - output should be the same as original input. See original input file listing on page 'D1'


 3a. cat dat3/idxf8Lcbl
     ==================
 0010.0060 idxtest text file to create Var Lth Indexed files.
 0020.0064 - input to COBOL,uxcp,uxcopy to create IDXf1,3,8 files
 0030.0065 - 01-04=ISAM key, 05=separator, 06-09=size, 10-400 text
 0040.0067 - output record varies from 64 to 256, depending on 06-09
 0050.0080 - here is an 80 byte record------------------------------------------>
 0060.0160 - here is a 160 byte record...........................................
 0070.0240 - here is a 240 byte record (last record in file).....................
 ===============================================================================>

 4. diff dat1/idxtest dat3/idxf8Lcbl
    ================================
    - verify that result is same as original input file
      (result of converting to IDXf8 by uxcp & back to LST by COBOL)
  1. Check the IDXf8 file created by COBOL - must use uvhd, see next page ----->

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

8I2. test IDXf8 compatibility by creating with uxcp & reading back wit h COBOL

using uvhd to check IDXf8 file created by uxcp

We must use 'uvhd' to investigate the IDXf8 file, since it contains binary. Note that option 'v' is required to interpret the IDXf8 format. This will show the file control record & the data records (with each data record starting in a new block display). You could use uvhd without option 'v' which simply displays each 256 byte block without regard to record boundaries.


 uvhd dat2/idxf8Iux.dat v        <-- display IDXf8 file (created by uxcp)
 ========================          - need option 'v' for IDXf8 or IDXF3 files
                      10        20        30        40        50        60
 r#        1 0123456789012345678901234567890123456789012345678901234567890123
           0 3.......0801141140412408011411404124.>.......................<..
             3F00000033333333333333333333333333330300000000000000000000000300
             3E00000008011411404124080114114041240E02001800001060000010000C00
          64 ............................................X"8*X"8*............
             0000000000000000000000000000000000000000000052325232000000000011
             00000007000022100000000000000000000000000008828A828A000000000008
         128 ................................................................
             00000011000000000000000000000000000000000000000F0000000000000000
             000000084244010400000040000000C0000000000000003E0000000000000000
               - - - remainder of header deleted (all x'00's to 1024 - - -
                      10        20        30        40        50        60
 r#        2 0123456789012345678901234567890123456789012345678901234567890123
        3336 @<0010.0060 idxtest text file to create Var Lth Indexed files...
             4333332333326677677276772666627626766762567247624666766266667200
             0C0010E00600948453404584069C504F032514506120C4809E45854069C53E00
                      10        20        30        40        50        60
 r#        3 0123456789012345678901234567890123456789012345678901234567890123
        3400 @@0020.0064 - input to COBOL,uxcp,uxcopy to create IDXf1,3,8 fil
             4433332333322266777276244444277672776677276267667624456323232666
             000020E00640D09E05404F03F2FCC5830C583F0904F0325145094861C3C8069C
          64 es..
             6700
             5300
                      10        20        30        40        50        60
 r#        4 0123456789012345678901234567890123456789012345678901234567890123
        3472 @A0030.0065 - 01-04=ISAM key, 05=separator, 06-09=size, 10-400 t
             4433332333322233233345442667223337676767672233233376762233233327
             010030E00650D001D04D931D0B59C005D3501214F2C006D09D39A5C010D40004
          64 ext.
             6770
             5840
                      10        20        30        40        50        60
 r#        5 0123456789012345678901234567890123456789012345678901234567890123
        3544 @C0040.0067 - output record varies from 64 to 256, depending on
             4433332333322267777727666762767667267662332762333226676666662662
             030040E00670D0F540540253F240612953062FD06404F0256C04505E49E70FE0
          64 06-09...
             33233000
             06D09000
              - - - remainder of file omitted (to fit on 1 page) - - -

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

8J1. COBOL program to create Variable Length Non-Indexed file

       $SET IDXFORMAT(8)
        identification division.
       * idxf8vs1 - test IDXFORMAT8 Variable length Seqntl files
       * - load a variable length non-indexed file (record-size < 4K)
       * compile & run the .int program without JCL as follows:
       * 1.  cd /home/uvadm            #subdirs: cbls, cblx, dat1, tmp1
       * 2.  mkdir cblx tmp1           #make output subdir if not present
       * 3.  mfcbl1 idxf8vs1.cbl       #compile program (output in cblx)
       * 4a. export FILE1=dat1/idxtest #declare input file
       * 4b. export FILE2=dat2/idxf8vs #declare output file
       * 5.  cobrun cblx/idxf8vs1      #execute program
        program-id. idxf8vs1.
        environment division.
        input-output section.
        file-control.
            select filein assign external file1
                   organization is line sequential.
            select fileout assign external file2
                   organization is sequential
                   access is sequential.
        data  division.
        file section.
        fd  filein record contains 500 characters.
            01 filein-rec.
               05 inreckey        pic  x(4).
               05 filler          pic  x.
               05 inrecsize       pic  9(4).
               05 inrecdata       pic  x(491).
        fd  fileout record varying from 50 to 500 depending on recsize.
            01 fileout-rec.
               05 outreckey        pic  x(4).
               05 filler           pic  x.
               05 outrecsize       pic  9(4).
               05 outrecdata       pic  x(491).
        working-storage section.
        01  filein-eof             pic  x value ' '.
        01  recsize                pic  9(4).
       *
        procedure division.
        mainline.
            open input filein.
            open output fileout.
            move spaces to filein-rec.
            read filein at end move '1' to filein-eof.
            perform dtlrtn until filein-eof = '1'.
            close filein fileout. stop run.
        dtlrtn.
            move spaces to fileout-rec.
            move filein-rec to fileout-rec.
            move inrecsize to outrecsize.
            move inrecsize to recsize.
            write fileout-rec.
            move spaces to filein-rec.
            read filein at end move '1' to filein-eof.

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

8J1. COBOL program to create Variable Length Non-Indexed file


 uvhd dat2/idxf8vs v      <-- investigate Varlth NonIndexed file
 ===================        - created by COBOL program idxf8vs1.cbl
 uvhd filename=/home/uxcbltest/dat2/idxf8vs
 options=x lastmod=2007062112 today=20070702090058 iprint=i6
 rec#=0 rcount=1 filesize=900 recsize=128 fsize%rsize(remainder)=0
                      10        20        30        40        50        60
 r#        0 0123456789012345678901234567890123456789012345678901234567890123
           0 0~......0706211207519207062112075192.>.......................2..
             370000003333333333333333333333333333030000000000000000000F000300
             0E00000007062112075192070621120751920E01000000001000000014000200
          64 ............................................X"8*................
             0000000000000000000000000000000000000000000052320000000000000000
             00000000000000100000000000000000000000000000828A0000000000000000
                      10        20        30        40        50        60
 r#        1 0123456789012345678901234567890123456789012345678901234567890123
         128 @<0010.0060 idxtest text file to create Var Lth Indexed files ..
             4333332333326677677276772666627626766762567247624666766266667200
             0C0010E00600948453404584069C504F032514506120C4809E45854069C53000
                      10        20        30        40        50        60
 r#        2 0123456789012345678901234567890123456789012345678901234567890123
         192 @80020.0056 - input to COBOL & uxcp to create IDXFORMAT1,3..
             433333233332226677727624444422277672762676676244544544532300
             080020E00560D09E05404F03F2FC060583004F032514509486F2D141C300
                      10        20        30        40        50        60
 r#        3 0123456789012345678901234567890123456789012345678901234567890123
         252 @H0030.0072 - 01-04=ISAM key, 05=.separator,06-09=recsize,10-400
             4433332333322233233345442667223332767676767233233376676762332333
             080030E00720D001D04D931D0B59C005DE3501214F2C06D09D25339A5C10D400
          64  text     ..
             276772222200
             045840000000
                      10        20        30        40        50        60
 r#        4 0123456789012345678901234567890123456789012345678901234567890123
         328 @L0040.0076 - output record varies from 64 to 256 depending on r
             4433332333322267777727666762767667267662332762333266766666626627
             0C0040E00760D0F540540253F240612953062FD06404F025604505E49E70FE02
          64 ecsize 06-09  ..
             6676762332332200
             5339A5006D090000
                      10        20        30        40        50        60
 r#        5 0123456789012345678901234567890123456789012345678901234567890123
         408 @P0050.0080 - here is an 80 byte record-------------------------
             4533332333322266762672662332677627666762222222222222222222222222
             000050E00800D0852509301E080029450253F24DDDDDDDDDDDDDDDDDDDDDDDDD
          64 ----------------->..
             22222222222222222300
             DDDDDDDDDDDDDDDDDE00

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

Part_9 Converting Mainframe COBOL to Windows (SFU,UWIN,CYGWIN)

Note
  • Part_9 will document only the differences from Unix/Linux procedures

Special Considerations for Windows (SFU,UWIN,CYGWIN)


9A1. profile for Windows SFU (Services For Unix)

9B1. compile options file for Micro Focus COBOL Net Express (for Windows)

9C1. scripts to compile programs on Windows (under SFU, UWIN,or CYGWIN)
- 1 at a time or All programs in a directory
- mfnxcbl1 & mfnxcblA compile to .int's for animation
- mfnxcbl2 & mfnxcblB compile to .exe's (executables)

9C2. mfnxcbl1 listed
- others available in /home/uvadm/sf/IBM/...

9D1. Animating with Net Express under Windows/SFU when compiling to .ints
9D2. Animating with Net Express under Windows/SFU if usual compile is .exe

9E1. COBOL compile problems

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

9A1. Converting Mainframe COBOL to Windows (SFU,UWIN,CYGWIN)

profile for SFU under Windows

 # profile_SFU - profile for Vancouver Utilities under Windows SFU 3.5
 #             - this file stored in /home/uvadm/env/profile_SFU
 # 1. cd /home/uvadm              - change to uvadm homedir (D:\SFU\home\uvadm)
 # 2. cp env/profile_SFU .profile - copy & change name of profile_SFU
 # 3. vi .profile                 - modify as desired (for COBOL, etc)
 # see SFU notes in WindowsDOS.doc in volume 1 of UVdoc or on UVSI web site
 # 1. setup user 'uvadm' on windows
 # 2. specify homedir for user uvadm on windows
 #    start --> programs --> AdminTools --> control panel --> ComputerMngnmt
 #    --> local users&groups --> users --> 'uvadm' --> profile -->
 #    --> Home folder --> local path --> D:\SFU\home\uvadm
 # 3. setup shortcut on desktop to login
 #    start --> programs --> WindowsSFU --> Korn shell
 #    --> right-click on Korn shell & drag to the desktop
 # 4. Customize screen by modifying properties of uvadm korn shell desktop Icon
 #    rtclick ksh icon --> properties --> set maximized, screen size,& BG color
 #    (see details in WindowsDOS.doc guide for installing VU on Windows SFU)
 #----------------------------------------------------------------------------
 # setup critical environmental variables for Vancouver Utilities & appsadm
 export UV=/home/uvadm               # <-- UV homedir symbol used below
 export APPSADM=/home/appsadm        # <-- site applications administrator
 # setup critical environmental variables for mainframe conversions
 export RUNLIBS=$HOME/testlibs    # <-- demo uses /home/mvstest for testlibs
 export RUNDATA=$HOME/testdata    # <-- apps superdir of data subdirs
 # above RUNLIBS & RUNDATA used for MVS JCL conversion test/demo
 # production should use separate filesystems for RUNLIBS & RUNDATA for example:
 # export RUNLIBS=/u1/apps/prodlibs/apay <-- sample Acts PAYable system
 # export RUNDATA=/u2/apps/proddata      <-- RUNDATA subdirs apay,arecv,etc
 #----------------------------------------------------------------------------
 # Setup 'PATH' for programs, scripts,& JCLs
 export PATH=$PATH:$UV/bin               #<-- append UV progs,scripts,RUNLIBS jcls
 export PATH=$PATH:$UV/sf/adm:$UV/sf/demo:$UV/sf/util:$UV/sf/IBM
 export PATH=$PATH:$APPSADM/sf:$RUNLIBS/jcls:$RUNLIBS/sf
 # Setup $PFPATH for uvcopy & uvqrpg interpreter to find Parameter Files (jobs)
 # - use symbol $UV (defined above) to shorten PFPATH definition
 export PFPATH=$UV/pf/adm,$UV/pf/demo,$UV/pf/util,$UV/pf/IBM
 export PFPATH=$RUNLIBS/pf,$APPSADM/pf,$HOME/pf,$PFPATH  #<-- UV pfs last
 #     - UV/pf/... follows RUNLIBS,APPSADM,HOME to allow user duplicate names
 #note - uvcopy accepts ',' comma delimiters so no conflict with ':' colons
 #     - in case you wanted to use D:/ vs /d/
 # Setup 'FPATH' for Korn shell functions (used by mainframe JCL/scripts)
 export FPATH=$RUNLIBS/sfun  # functions for ksh (Korn shell)
 #----------------------------------------------------------------------------
 # printer destinations, modified for Windows SFU
 export LPDEST="LPT1"        # default dest if lp -d unspcfd
 export UVLPDEST="-dLPT1"    # default dest for uvlp(uvlist) scripts
 export UVLPOPTN=""          # "-onobanner" for unix/linux (SFU does not allow)
 export UVHDPRINT=uvlp12     # script for uvhd 'i' immediate print command
 export UVHDPWIDE=uvlp12L    # script for uvhd 'iprint' Landscape 100 chars/line
 # export PT=":"             # inhibit jcl printing for programmer testing
 # export LPSDIR=/home/ezadm                # activate for EasySpooler
 # export LPOPTION="-dlp01 -onob -odata=a"  # options for EasySpooler
 #-------------------------------------------------------------------------
 # set TERM type depending on unix/linux system ??
 export TERM=interix           # <-- modify TERM as required
 trm=$(tty)                    # capture terminal device for echo below
 echo "terminal device tty=$trm and terminal type TERM=$TERM"
 #-------------------------------------------------------------------------
 # Misc Recommended items
 umask 002                     # permissions 775 dirs, 664 files
 # stty intr '^C'              # interrupt ^C, (probably already default ?)
 set -o ignoreeof              # disallow logoff via ctl D (use exit)
 HOST1=$(uname -n)             # add to PS1 prompt if desired
 trmv=${trm#/dev/}             # remove prefix /dev/
 export PS1='<@$LOGNAME:$PWD> '
 export EDITOR=vi              # for Korn shell history
 export VISUAL=vi              # for Korn shell history
 export HISTSIZE=1000;         # Korn shell history file size
 export COBMAPDIR=$RUNLIBS/maps # for uvhdcob (display data with fieldnames)
 export ISDATEXT=".dat"         # '.dat' for MF COBOL Fixed length Indexed
 #-------------------------------------------------------------------------
 # alias commands to prompt for overwrite (highly recommended)
 # - use \rm, \mv, \cp, (or option '-f') when you have many files
 # - '\' tells Unix/Linux to ignore the alias & use native unix/linux command
 alias rm='rm -i'              # confirm removes
 alias mv='mv -i'              # confirm renames
 alias cp='cp -i'              # confirm copy overwrites
 alias cdd='cd $RUNDATA'       # quick access to data dir
 alias cdl='cd $RUNLIBS'       # quick access to libs (same as cd)
 alias l='ls -l'               # not required for UnixWare
 #-------------------------------------------------------------------------
 # for Micro Focus COBOL Net Express for Windows SFU
 # - see compile scripts mfnxcbl1 & mfnxcblA in /home/uvadm/sf/IBM
 export LD_LIBRARY_PATH=/dev/fs/D/MF/NetExpress/Base/lib
 export COBDIR=D:\\MF\\NetExpress\\Base
 export PATH=$PATH:/dev/fs/D/MF/NetExpress/Base/BIN
 export COBCPY=$(unixpath2win $RUNLIBS/cpys) # for compile script mfnxcbl1
 export COBDIR=$(unixpath2win $RUNLIBS/cblx)\;$COBDIR
 # - cblx added to COBDIR so 'runw' can find .int/.idy without path
 # MicroFocus also required to compile 'ux' programs (uxcp,uxsort,uxcopy,uxqrpg)
 # - with cobccuv script to support ISAM Variable length (IDXFORMAT3 files)
 #--------------------------------------------------------------------------
 # activate for Morada RPG compiler
 # export RPGCDIR=/home/rpgadm            # if you use Morada RPG compiler
 # export PATH=$PATH:$RPGCDIR/bin         # append RPG bin to PATH
 # export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/rpgadm/lib  # for Morada RPG
 # export SIGN_OVERRIDES=UN-7             # x'70' neg zone signs for RPG programs
 # export ISDATEXT=".dat"                 # RPG could use .dat ext on DISAM files
 #--------------------------------------------------------------------------
 # Capture console log files (see details in ADMjobs.doc in vol3 of UVdoc)
 export LOGDIR=$APPSADM     # ADMjobs.doc recommends LOGDIR in /home/appsadm
 # LOGDIR must contain subdirs log1,log2,log3 (current file,cur month,lastmonth)
 # - each of log1,log2,log3 must have subdirs matching $LOGNAME
 ## uncomment next 4 lines in .profiles of users who require logging
 ## login1 || exit 2          # exit here if 2nd login
 ## logfixA                   # process log1 file to log2 (to allow read/print)
 ## echo 'console logging requires --> . aliases <-- setup aliases at logon'
 ## exec script $LOGDIR/log1/$LOGNAME/$(date +%y%m%d_%H%M%S)
 #Note - the 'exec script' must be the last non-comment line in the .profile
 #     - ':' changed to '_' (in %y%m%d_%H%M%S) works for both windows & linux

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

9B1. Converting Mainframe COBOL to Windows (SFU,UWIN,CYGWIN)

COBOL compile Options for MF Net Express

 & cobol.dir - Directives file for Micro Focus COBOL Net Express 4.0
 &           - in $COBDIR for system wide effect
 &           - COBDIR=D:\MicroFocus\NetExpress\Base for VU testing
 &           - following Directives used to compile programs from mainframe
 ANS85
 CASE
 FILESHARE
 IBMCOMP
 LIST()
 NOSEG
 SPZERO
 NOVERBOSE
 XREF
 SIGN(ASCII)

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

9C1. Converting Mainframe COBOL to Windows (SFU,UWIN,CYGWIN)

compiling COBOL programs under SFU/UWIN/CYGWIN

SFU, UWIN, & CYGWIN are unix/linux emulators for Windows (95,98,NT,2000,XP) Please see WindowsSFU.htm for important notes about installing SFU & VU. Please see CygwinUwin.htm for important notes about installing UWIN & CYGWIN and the Vancouver Utilities,

Note that environmental variable COBCPY must define the copybook subdir. See the profiles for SFU, UWIN,& CYGWIN in the install guide WindowsSFU.htm begining on page 'F1'.

script to compile 1 program (under SFU/UWIN/CYGWIN)


 mfnxcbl1 program [srcdir] [outdir]  <-- command format
 ==================================

 mfnxcbl1 cap100.cbl cbls cblx   <-- example
 =============================

 mfnxcbl1 cap100.cbl    <-- minimum command (arg2 & 3 default as shown above)
 ===================

 mfnxcbl1 cap100.cbl     - mfnxcbl1 compiles to .int/.idy to allow animation
 ===================

 mfnxcbl2 cap100.cbl     - mfnxcbl2 compiles to .exe
 ===================

See the 'mfnxcbl1' script listed ahead on page '9C3' --->

script to compile ALL programs (under SFU/UWIN/CYGWIN)


 mfnxcblA all [srcdir] [outdir]    <-- command format
 ==============================

 mfnxcblA all cbls cblx   <-- example
 ======================

 mfnxcblA all             <-- minimum (arg2 & 3 default as shown above)
 ============

 mfnxcblA all              - mfnxcblA compiles to .int/.idy to allow animation
 ============

 mfnxcblB all              - mfnxcblB compiles to .exe's
 ============

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

9C2. Converting Mainframe COBOL to Windows (SFU,UWIN,CYGWIN)

Notes re COBOL compiles under SFU/CYGWIN/UWIN

Micro Focus Net Express (COBOL compiler for Windows) expects the 'COBCPY' environmental variable to point to the COBOL copybook directory. Since Net Express is a Windows program, the path must be in the DOS/WINDOWS format.


 SET COBCPY=H:\mvstest\cpys
 ==========================

For CYGWIN, COBCPY could be defined in this format in the desktop ICON startup batch file which launches CYGWIN/BASH. The Unix/Linux equivalent would be:


 export COBCPY=H:\\mvstest\\cpys   <-- works for SFU & CYGWIN (but not for UWIN)
 ===============================

Since '\' is the escape character in unix, you code 2 to get a real backslash. This does work for CYGWIN, but not for UWIN (see problem below). This export can be placed in the profile or in the COBOL compile script (mfnxcbl1).

Problem re COBOL compiles under UWIN

For UWIN the COBCPY export would be:


 export COBCPY=D:\\users\\mvstest\\cpys  <-- does not work for UWIN
 ======================================

echo $COBCPY --> D:\users\mvstest\cpys <-- looks good but does not work

I have proven that '\c' causes the problem since if I change the name of the copybook directory from \cpys to \books it works OK.

The best solution is to use the SFU/UWIN/CYGWIN commands provided for this purpose. The following are now coded in the suggested profiles for SFU, UWIN, & CYGWIN listed in the install guide WindowsSFU.htm begining on page 'F1'.


 export COBCPY=$(winpath /d/users/mvstest/cpys)    <-- for UWIN
 ==============================================

 export COBCPY=$(cygpath -w /h/mvstest/cpys)       <-- for CYGWIN
 ===========================================

 export COBCPY=$(unipath2win $RUNLIBS/cpys)        <-- for SFU
 ==========================================

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

9C3. Converting Mainframe COBOL to Windows (SFU,UWIN,CYGWIN)

mfnxcbl1 - compile MFC Net Express under SFU/UWIN/CYGWIN

 #!/bin/ksh
 # mfnxcbl1 - compile Micro Focus Net Express on Windows under SFU/UWIN/CYGWIN
 #          - see Vancouver Utility doc MVSCOBOL.doc part_9
 #
 # - option (r1) must be used in JCL conversion to generate 'runw' for .ints
 # - COBOL compile scripts & corresponding option (r_) as follows:
 #*mfnxcbl1 (r1) (Windows NX) compiles 1 program to .int & .idy
 # mfnxcblA (r1) (Windows NX) - compile ALL to .ints (allow ANIMation)
 # mfnxcbl2 (r2) (Windows NX) - compile 1 program to .exe
 # mfnxcblB (r2) (Windows NX) - compile ALL programs to .exe
 # mfcbl1   (r0) (Unix/Linux SX) - compile 1 program to .int/.idy
 # mfcblA   (r0) (Unix/Linux SX) - compile All programs to .int/.idy
 #
 # must be in libs superdir with following subdirs:
 # 1. cpys - cobol copybooks, defined by environmental variable 'COBCPY'
 # 2. cbls - cobol source programs, may specify alternate subdir via arg2
 # 3. cblx - cobol executable output, may specify alternate subdir via arg3
 #
 # SFU, UWIN & CYGWIN are unix/linux emulators for Windows
 # - see SFU (Services For Unix) at www.microsoft.com/windows/SFU/
 # - see UWIN at www.wipro.com/uwin & CYGWIN at www.cygwin.com
 #
 # COBCPY environmental variable should be defined in profile
 # export COBCPY=H:\\mvstest\\cpys   <-- works for SFU & CYGWIN, not UWIN
 # ===============================
 # export COBCPY=$(winpath /d/users/mvstest/cpys)  <-- for UWIN
 # ==============================================
 #
 ps="$1"           # capture arg1 as source program name
 # capture optional srcdir & exedir or default to cbls & cblx if not spcfd
 if [[ -n "$2" ]]; then sd="$2"; else sd=cbls; fi
 if [[ -n "$3" ]]; then xd="$3"; else xd=cblx; fi
 #
 if [[ -f "$sd/$ps" && -d "$sd" && -d "$xd" ]]; then :
 else echo "compile program(arg1) [from sourcedir(arg2)] [to outdir(arg3)]"
      echo "usage: mfnxcbl1 program [srcdir] [outdir] <- program must be file in srcdir"
      echo "       =================================="
      echo "ex1:   mfnxcbl1 cap100.cbl cbls cblx  <- srcdir/outdir default as shown"
      echo "       ============================="
      echo "ex2:   mfnxcbl1 cap100.cbl        <- can omit arg2&3 if defaults OK"
      echo "       ==================="
      exit 1; fi
 #
 p=${ps%\.*}                  # capture programname without .extension
 cp $sd/$ps $xd               # copy source into output subdir
 cd $xd                       # change into output subdir
 cobol.exe $ps,,,,ANIM NOOBJ; # compile program (creates .int .idy .obj .grp)
 #===========================
 rm -f $p.obj $p.grp          # remove object & group from output subdir
 cd ..                        # change back up to superdir
 mv -f $xd/$p.lst cblst     # move source listing to dedicated subdir
 exit 0                       # ANIMation requires source same dir as .int/.idy
 #

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

9D1. Testing & Debugging Aids

Animating under SFU/UWIN/CYGWIN & Net Express COBOL

Here is an example of how to animate car100.cbl in jar100.ksh. We assume:


 #1a. SFU & Vancouver Utilities installed on windows as per WindowsSFU.htm
 #1b. UWIN & VU installed on windows as per install.htm#E1 thru E4.
 #1c. CYGWIN & VU installed on windows as per install.htm#F1 thru F10.

 #2a. Account 'mvstest' setup on SFU as per WindowsSFU.htm.
 #2b. Account 'mvstest' setup on UWIN as per CygwinUwin.htm.
 #2c. Account 'mvstest' setup on CYGWIN as per CygwinUwin.htm.

 #3a. profile (with COBDIR,etc) setup on SFU as on page '9A1'.
 #3b. profile (with COBDIR,etc) setup on UWIN as per CygwinUwin.htm.
 #3c. profile (with CIBDIR,etc) setup on CYGWIN as per CygwinUwin.htm.

 #4. COBOL programs have been compiled by mfnxcbl1 or mfnxcblA, which include
     the following line to compile for ANIMation:

     cobol $ps,,,,ANIM NOOBJ;  <-- compile for animation
     ========================    - creates: car100.idy & car100.int

 #5. The JCL has been converted with option 'r1' (in ctl/jclunixop51), which
     generates COBOL program executions as follows (using jar100 for example):

     runw jar100      <-- runw executes .int (& .idy if animation switch on)
     ===========

Animation Operating Instructions on SFU/UWIN/CYGWIN


 #1a. Logon to Windows as mvstest & click on SFU ksh desktop ICON
 #1b. Or click on UWIN desktop ICON & login as mvstest
 #1c. Or click on CYGWIN/mvstest ICON on windows desktop
     --> SFU homedir D:\SFU\home\mvstest (or /home/mvstest)
     --> UWIN homedir D:\users\mvstest (or /d/users/mvstest)
     --> CYGWIN homedir H:\mvstest (or /h/mvstest)
     --> subdirs: cbls, cpys, cblx, jcls, testdata, tmp, etc
     --> COBOL & JCL: cbls/car100.cbl, jcls/jar100.ksh
     --> input datafile: testdata/data1/ar.customer.master

 #2. export ANIM="+A"      <-- set animate switch on (ANIM="" for off)
     ================

 #3. jar100.ksh            <-- execute modified JCL
      ==========              - will animate car100 on a GUI screen

 #4. Debug car100 with animation commands
      - click on animate tab to see various animation functions
        (F11=step, F9=set breakpoint, F5=run, ^E=Examine fields, etc)

 #5. vi tmp/car100.cbl, recompile(mfnxcbl1), re-animate, etc

 #6. export ANIM=""        <-- switch animation off
     ==============

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

9D2. Testing & Debugging Aids

Animating under SFU/UWIN/CYGWIN & .exe compiles

If you normally use mfnxcbl2/mfnxcblB to compile COBOL programs to .exe's you will need a different strategy to animate your programs. Here is an example using the same program & JCL/script as on the previous page, where we always compiled programs to allow animation with mfnxcbl1/mfnxcblA. The 'assumptions' of the previous page also apply to this page.

Animation Operating Instructions on SFU/UWIN/CYGWIN


 #1a. Logon to Windows as mvstest & click on SFU ksh desktop ICON
 #1b. Or click on UWIN desktop ICON & login as mvstest
 #1c. Or click on CYGWIN/mvstest ICON on windows desktop
     --> SFU homedir D:\SFU\home\mvstest
     --> UWIN homedir D:\users\mvstest
     --> CYGWIN homedir H:\mvstest
     --> subdirs: cbls, cpys, cblx, jcls, testdata, tmp, etc
     --> COBOL & JCL: cbls/car100.cbl, jcls/jar100.ksh
     --> input datafile: testdata/data1/ar.customer.master

 #2. rm -f tmp/*             - remove any old files from tmp subdir

 #3. cp cbls/car100.cbl tmp  - copy cobol source to tmp subdir
     ======================

 #4. cd tmp                  - change into tmp subdir

 #5. cobol car100.cbl,,,,ANIM NOOBJ;  <-- compile for animation
     ===============================    - creates: car100.idy & car100.int

 #6. cd ..                      - change back to mvstest working dir

 #7. cp jcls/jar100.ksh tmp     - copy JCL to tmp subdir for changes

 #8. vi tmp/jar100.ksh          - modify JCL for animation (in tmp vs jcls)
     =================
     #$CBLX/car100                   - comment out original call to cobol program
     runw H:\\mvstest\\tmp\\car100  - use 'runw' to run/animate .int/.idy/.cbl
     =============================
     :wq                          - write out jcl & quit editor

 #9. export ANIM="+A"           <-- set animate switch on (ANIM="" for off)
     ================

 #10. tmp/jar100.ksh            <-- execute modified JCL (in tmp vs jcls)
      ==============              - will animate car100 on a GUI screen

 #10. Debug car100 with animation commands
      - click on animate tab to see various animation functions
        (F11=step, F9=set breakpoint, F5=run, ^E=Examine fields, etc)

 #11. vi tmp/car100.cbl, recompile, re-animate, etc

 #12. cp tmp/car100.cbl cbls    <-- copy debugged program back to source dir
      ======================

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

9E1. Converting Mainframe COBOL to Windows (SFU,UWIN,CYGWIN)

Missing Copybook Problem on UWIN

When compiling using Net Express & a copybook is missing, the compiler prompts you as follows:


 FILE NOT FOUND, Reply: Stop/Retry/Continue/Alter-path ??
 ========================================================

You can reply 'A' & then you will be prompted to enter the pathname to the missing copybook. Or you could goto another login screen, copy the missing file into $COBCPY (which defines the copybook directory & is usually specified in the profile), and then reply 'R' to retry. Or it may be faster to 'Stop' or 'Continue' (let it fail), then fix the missing copybook problem & rerun the compile.

The above assumes you are using the 'mfnxcbl1' script to compile 1 program at a time. If you are using 'mfnxcblA' to compile All programs in the directory, you will not see the above message, since mfnxcblA captures the compiler messages into a file, which is displayed at the end of each compile.

So if you are using mfnxcblA & a copybook is missing, the script appears to hang up with no error indication (for the reason described above), I suggest you reply 'C' to let the mass compile continue. Then we can print out all the .err files collected in the cblx subdir & correct the problems more efficiently.

Note that the script cannot 'tee' the compiler messages to the screen since we need to capture the return code (success/fail) from the compiler & not from the 'tee' command.

Missing Copybook Problem on CYGWIN

Missing copybooks are a bigger problem on CYGWIN, even if we are only compiling 1 program at a time (using mfnxcbl1 vs mfnxcblA). If you get the missing copybook error message:


 FILE NOT FOUND, Reply: Stop/Retry/Continue/Alter-path ??
 ========================================================

For some as yet unexplained reason, replies are not accepted. The only thing you can do is 'ctl Break' to kill the compiler & the script, which is a problem if we are using mfnxcblA to compile all programs.

Does anyone have a solution for this problem ??

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

Visitor Counters for ThisYear and LastYear