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 |
Part_2 | - COBOL conversions Explained |
- Operating Instructions to Convert & Compile COBOL programs | |
- demo programs illustrated Before & After conversion | |
- unixwork1.cpy - copybook inserted at WORKING-STORAGE | |
- unixproc1.cpy - copybook inserted at the end of the program | |
- running JCL/script jar100.ksh to execute COBOL program car100.cbl |
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 |
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 |
Part_7 | - COBOL conversion Problems & Solutions |
- inserting 'recording mode v' into appropriate FD's | |
- mainframe assumed if different recsizes under FD, or occurs depending | |
- Micro Focus COBOL requires 'recording mode v' explicitly |
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
Here is a brief review of the documentation relevant to mainframe conversions & accessible on the UV Software web site (www.uvsoftware.ca).
MVSJCL.htm | - MVS JCL Conversion |
VSEJCL.htm | - VSE JCL Conversion |
MVSDATA.htm | - Convert MVS EBCDIC Data to ASCII, preserving packed fields |
VSEDATA.htm | - Convert VSE EBCDIC Data to ASCII, preserving packed fields |
MVSCOBOL.htm | - MVS COBOL Conversion |
VSECOBOL.htm | - VSE COBOL Conversion <-- This Document |
Note |
|
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
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
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
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 |
- cnvMF4Ac for 'All copybooks' & cnvMF4A for 'All programs' | |
- BUT, we recommend the 'step by step' Op. Instrns. for your 1st convert |
1D1. | step by step Op. Instrns. to Convert the Demo COBOL 'CopyBooks' |
1D2. | Pre-Requisite for COBOL program conversion (cobmap1 & cpyrcs1I) |
- fix for 01name present/missing in program & copybook under FD or W-S | |
1D3. | Overview program conversion, convert report files to Line Sequential |
- Unix/Linux conversions for SYSIN & SYSOUT | |
1D4. | step by step Op. Instrns. to Convert the Demo COBOL 'Programs' |
1D5. | Sample output of 'mfcblA' script to compile ALL COBOL programs |
- captures 1st few errors for compile failues | |
1D6. | Compile Error Analysis, report 1st few errors for compile failures |
- operating instructions for uvcopy jobs cblerrs1 & cblerrs2 | |
1D7. | Sample ERROR 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 |
- cnvMF41c for 1 copybook & cnvMF41 for 1 program |
1G2. | scripts to reconvert copybooks & programs - All in directory |
- cnvMF4Ac for All copybooks & cnvMF4A for All programs |
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
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 VSEJCL.htm & MVSJCL.htm.
Here in VSECOBOL.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 VSEJCL.htm or MVSJCL.htm.
Also note that there are some differences in the COBOL conversions Operating Instructions between VSE & MVS 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.
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.
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
/home/vsetest <-- setup user 'vsetest' & copy subdirs from uvadm/vsetest :-----testlibs : :--*--Csub - C subroutines for COBOL programs : :--*--cbl0 - COBOL programs ('*' means files present) : :-----cbl1 - cleaned up, cols 1-6 & 73-80 cleared, etc : :-----cbl2 - cnvMF4 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 - cnvMF4 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 : :-----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 'vsetest' and copy all above subdirs from /home/uvadm/vsetest to /home/vsetest before running the various conversion jobs.
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
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/vsetest (or /home/uvadm/mvstest).
You will be instructed to setup a test/demo userid/login 'vsetest' (or 'mvstest'). Then copy the subdirs from /home/uvadm/vsetest to /home/vsetest (or 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 are critical environmental variables defined in the profile. See the recommended profile for this test/demo listed on page '5A1'. RUNLIBS=$HOME/testlibs and RUNDATA=$HOME/testdata. Since $HOME=/home/vsetest for test/demo the result will be: 'RUNLIBS=/home/vsetest/testlibs' and 'RUNDATA=/home/vsetest/testdata'.
RUNLIBS is used in the PATH to define where the JCL/scripts are to be found. RUNDATA is used in the jobset41 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
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).
After installing the Vancouver Utilities as per install.htm, the test/demo files may be found within 2 subdirs (/home/uvadm/vsetest & /home/uvadm/mvstest). Use whichever is approriate for you, but this documentation will refer primarily to 'vsetest' (please make mental substitutions as approriate).
#1. Setup a user login account for the test/demo. Please make it 'vsetest' (or 'mvstest'), so the test/demo conversions will work without having to modify any control files (profile, jobset41, jclunixop41, 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_test) to the unix/linux system profile (/home/vsetest/.bash_profile). See the instructions at the beginning of the supplied profile listed on page '5A1'.
#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: vsetest --> /home/vsetest
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
#5. Copy the supplied test/demo files from uvadm to your new home directory.
#5a. cp -r /home/uvadm/vsetest/* /home/vsetest =========================================
-- OR --
#5b. 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 |
|
You must stay in the home directory (/home/vsetest or /home/mvstest). 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
There are scripts to that perform all steps of the conversions (cnvMF4Ac for copybooks & cnvMF4 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'.
cnvMF4Ac 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
cnvMF4A 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
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 (cnvMF41c/cnvMF4Ac for copybooks,& cnvMF41/cnvMF4A for programs).
See the scripts summarized on page '1G1' & '1G2'. See the scripts listed on pages '5C2' & '5C3'.
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 VSECOBOL.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=q0i7c5e15g8j1k1l3n1s8t1w4,arg1=.cpy =================================================================
Note |
|
#2. uvcopy cnvMF4,fild1=cpy1,fild2=cpy2,fili3=ctl/cnvcob4.tbl,uop=q0i7m2l0 ====================================================================== - convert COBOL CopyBooks for Unix/Linux Micro Focus compiler
#3. cp cpy2/* cpys - copy converted copybooks to standard library ==============
Note |
|
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
As of April 2010, we have added a pre-requisite for cobol PROGRAM conversions. Before running cnvMF4A (convert All) or cnvMF41 (convert 1), you must run 'cobmap1' & 'cpyrcs1A' to load an Indexed file of copybook names & record sizes. The cobol program converter will lookup the Indexed file to get the record size and insert an '01' record definition on 'FD's that use copybooks.
This solves an incompatibility between the mainframe COBOL compiler & the Micro Focus COBOL compilers. For illustration, here is an FD, from demo program car100.cbl, which copies copybook 'custmas.cpy'.
FD CUSTMAS RECORD CONTAINS 256 CHARACTERS. 01 CM1. COPY "custmas.cpy".
* custmas - cobol copybook for customer.master file mvsjcl 01 custmas. 10 cm-cust pic 9(6). - - - 13 lines omitted - - - 10 filler pic x(16).
Without the April 2010 enhancement, Micro Focus COBOL gives the following ERROR (caused by the '01' in the program with no fields, followed by the '01' in the copybook):
21 01 cm1. * 217-S*** ** Preceding item at this level has zero length cob32: error(s) in compilation: car100.cbl
The enhancement adds a 'pic' with the record-size if copybook begins with an '01', but will *comment out the 'pic' if copybook already begins with an '01'.
fd custmas. 01 cm1 pic x(256). <-- 'pic x(256)' added from copybook copy "custmas.cpy". if copybook does NOT begin with '01'
fd custmas. ******* 01 cm1 pic x(256). <-- '01' in program *commented out copy "custmas.cpy". if copybook DOES begin with an '01'
The enhancements handle all combinations: 01 & copy on same line or different, under FD or in Working-Storage, 01 present in copybook or NOT.
#1. uvcopyx cobmap1 cpys maps uop=q0i7p0 ==================================== - generate cobmaps (record layouts) from copybooks
#2. cpyrcs1A maps <-- script to extract record-sizes & 01 from copybooks ============= & load Indexed file for lookup by cnvMF4A
ctl/cpyrcs1 - sequential file extracted from copybook/maps ctl/cpyrcs1I - Indexed file sorted/loaded from ctl/cpyrcs1
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
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---------->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)
The COBOL converter (cnvMF4) provides option 'l4' to lookup an indexed file to identify printer files as 'ORGANIZATION LINE SEQUENTIAL' on 'select' stmnts. See steps #2 & #3 on the next page are required for option 'l4'.
Option 'l4' 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. 'uvcopy cobfil45' scans all COBOL programs looking for OLS criteria and writes a file (xref/cobfil45a) to identify these files keyed by programname & filename. 'uvsort' is then used to sort & load these records into an indexed file (xref/cobfil45I) for lookup by 'uvcopy cnvMF4'.
Note |
|
The default is 'l3' which uses a table of keywords commonly used in printer & card filenames (print,report,rpt,card,etc). The default is OK for the test- demo's here in Part 1. See all options explained later in Part 6 on page '6G3'.
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
#1. uvcopyx cleanup cbl0 cbl1 uop=q0i7c5e15g8j1k1l1n1s8t1w4,arg1=.cbl ================================================================= - cleanup mainframe code, remove CRs, clear cols 1-6 & 73-80, etc
#2. uvcopy cobfil45,fild1=cbl1,filo2=xref/cobfil45a,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/cobfil45a,rcs=100,typ=LST,filo1=xref/cobfil45I,typ=ISF\ ,key1=0(44),isk1=0(44),del1=0(1):*" ========================================================================== - sort & load sequential file into indexed file for lookup by cnvMF4
#4. convert mainframe COBOL to Micro Focus COBOL
#4a. uvcopy cnvMF4,fild1=cbl1,fild2=cbl2,fili3=ctl/cnvcob4.tbl\ =========================================================== ,fili4=xref/cobfil45I,uop=q0i7m1l3 ==================================
#4b. uvcopy cnvMF4 <-- easy alternative (files & options default as above) ============= - options default OK for test/demo's here in Part 1 - see options explained later in Part 6 page '6G3'
#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.
#7. copy converted programs to subdir 'cbls' for compile script (mfcblA).
#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
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/vsetest/cpys:/cpys:/cpys compile options file=/home/vsetest/ctl/cobdirectives mfcblA started 050317:1236, ended 050317:1236
Note |
|
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
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 =================
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
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 =========================
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 =========================
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
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 |
|
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
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 ================================
#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'.
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 |
|
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
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 VSEJCL.htm & MVSJCL.htm, but here is a shortened version without explanations or illustrations.
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'
#2. jclpx41 jcl1 jcl2 procs sli1 ============================ - copy all jcl from jcl1 to jcl2, - expanding procs from arg3 & SLIs from arg4
#2a. jclpx41 jcl1 jcl2 jcl1 jcl1 =========================== - use this command if JCL, PROCs,& SLIs are all in 1 library
#3. uvcopy jcldata41,fild1=jcl2,filo2=ctl/datafiles41 ================================================= - generate Data control file (extracts filenames & types form JCL) - may add record-size & indexed file keys to improve conversions
#3a. uvcopy jcldata41 <-- 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/jclunixop41 & ctl/datafiles41 in Part 3 of VSEJCL.htm. 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
#4. jclxx41 jcl2 jcl3 - convert all JCL in jcl2 to scripts in jcl3 =================
'jclxx41' is a script that executes the 'jclunix41' conversion program for each file found in input subdir & copy results to output subdir. jclxx41 requires control files: ctl/jclunixop41, ctl/datafiles41,
#5. cp jcl3/* jcls - copy all converted JCL/scripts to subdir jcls ============== (since jcls is in the PATH, but not jcl3)
Note |
|
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'.
#1a. jcl2ksh41 JAR100 <-- convert 1 JCL at a time (for VSE) ================
#1b. jcl2ksh51 JAR100 OR <-- 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
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/vsetest
/home/vsetest :-----testlibs <-- $RUNLIBS : :-----cblx - compiled COBOL programs (.int's) : :-----jcls - copy here manually 1 by 1 during test/debug : :-----sfun - korn shell functions (jobset41,logmsg,etc)
export RUNDATA=/home/vsetest/testdata
/home/vsetest :-----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
The pages ahead will present the commands to execute the following JCL/scripts:
jar100.ksh |
|
jar200.ksh |
|
jgl100.ksh |
|
jgl200.ksh |
|
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
jar100.ksh ==========
JAR100:040428:202302: JOB begun JAR100:040428:202302: RUNDATA=/home/vsetest/testdata RUNLIBS=/home/vsetest JAR100:040428:202302: TAPE=tape,WRK=wrk,RPTS=reports/040428 JAR100:040428:202302: step# 1/1 car100 begun JAR100:040428:202302: file: CUSTMAS=ar/customer.master JAR100:040428:202302: file: NALIST=ar/customer.nameadrs.list100 JAR100:040428:202302: JOB=JAR100 Terminated Normally
jar200.ksh ==========
JAR200:040428:202311: JOB begun JAR200:040428:202311: RUNDATA=/home/vsetest/testdata RUNLIBS=/home/vsetest JAR200:040428:202311: TAPE=tape,WRK=wrk,RPTS=reports/040428 JAR200:040428:202311: step# 1/1 sort begun JAR200:040428:202311: file: SORTIN1=ar/sales.items JAR200:040428:202311: file: SORTOUT=wrk/##srtext JAR200:040428:202311: uvsort fili1=ar/sales.items,filo1=wrk/##srtext JAR200:040428:202311: EOF fili01 20 rds, 1280 size; ar/sales.items JAR200:040428:202311: sort phase complete, used 64 megabytes, sort output begin JAR200:040428:202311: EOF filo01 20 wrts, 1280 size; wrk/##srtext JAR200:040428:202311: step# 2/2 car200 begun JAR200:040428:202311: file: SALEDTL=wrk/##srtext JAR200:040428:202311: file: SALELST=ar/sales.list JAR200:040428:202311: JOB=JAR200 Terminated Normally
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
cnvMF41c 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
cnvMF41 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
cnvMF4Ac 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
cnvMF4A 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
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 - BEFORE conversion |
2D2. | sample program car100.cbl - AFTER conversion |
2D3. | conversion changes illustrated & explained |
2E1. | unixwrk1.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 |
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
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.
/home/vsetest <-- setup user 'vsetest' & copy subdirs from uvadm/vsetest :-----testlibs : :--*--Csub - C subroutines for COBOL programs : :--*--cbl0 - COBOL programs ('*' means files present) : :-----cbl1 - cleaned up, cols 1-6 & 73-80 cleared, etc : :-----cbl2 - cnvMF4 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 - cnvMF4 converts mainframe COBOL to Micro Focus COBOL : :-----cpys - copy here (standard copybook library) : :--*--ctl - conversion control files (cnvcob4.tbl, cobdirectives)
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
cpy0 ---------> cpy1 ---------> cpy2 ----------> cpys cleanup convert copy(cp)
#1. cnvMF4Ac all <-- convert ALL copybooks from cpy0 to cpy1 & cpy2 ============
#2. cp cpy2/* cpys <-- copy ALL converted copybooks to cpys (used by compiler) ==============
#1. cnvMF41c cpy0/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) ========================
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
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
* 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).
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
cbl0 ---------> cbl1 ---------> cbl2 ----------> cbls ---------> cblx cleanup convert copy(cp) compile
#1. cnvMF4A all <-- convert ALL programs from cbl0 to cbl1 & cbl2 ===========
#2. cp cbl2/* cbls <-- copy ALL converted programs to cbls (for compile) ==============
#1. cnvMF41 cbl0/CAR100.cbl <-- convert 1 program from cbl0 to cbl1 & cbl2 =======================
#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 =================
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
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
identification division. * car100 - test/demo mainframe conversion to micro focus cobol * - customer n&a list with report hdng & date via accept program-id. car100. 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 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 '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 ' '. * procedure division. uvM perform unixproc1. mainline. open input custmas. open output nalist. accept run-date from 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 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
uvM * select custmas assign custmas uvM * organization sequential access mode sequential.
uvM select custmas assign EXTERNAL custmas uvM organization RECORD sequential access mode sequential.
uvM stop run returning 0.
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
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
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.
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 $RLX/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.
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.
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
* unixwork1 - copybook for mainframe to unix/linux conversions * unixwork1/unixproc1 - for RUNDATE in ccyymmdd format * - see unixwork2/unixproc2 for mm/dd/ccyy format * copy "unixwork1.cpy". <-- inserted after 'WORKING-STORAGE' * - stores values accepted by unixproc1 * perform unixproc1. <-- inserted after 'PROCEDURE DIVISION' * copy "unixproc1.cpy". <-- inserted at end of program * - 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 * - COBOL converter replaces 'current-date' with 'rundate-mdy6e' * - includes code to display Micro Focus file status 01 unixwork1. 05 jobid1 pic x(16). 05 jobid2 pic x(16). 05 parm1-lth pic s9(4). 05 parm1-data pic x(200). * parm1-data retrieved by unixproc1 via env-name/value PARM * see demo JCL/COBOL jar120/car120 in MVSCOBOL.doc page 3C1+ * - mainframe programs use LINKAGE SECTION to store parm lth/data * - must move lth/data from this W/S to L/S separately * - since parm1-lth 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. **************** end of unixwork1 ***************************
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
* 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 parm1-data 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 parm1-lth. perform until (parm1-data (parm1-lth:1) not = " " or (parm1-lth < 1)) subtract 1 from parm1-lth. * jcl converter has 'export PARM="..." for PARM on EXEC stmnt * - see parm1-data & parm1-lth 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 ***************************
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
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 * unixwork1/unixproc1/testunix1 - for RUNDATE in ccyymmdd format * see unixwork2/unixproc2/testunix2 for RUNDATE mm/dd/ccyy format program-id. testunix1. 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.
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
* 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. * display "systime-hms6 " systime-hms6 upon console. display "jobstamp " jobstamp upon console. * 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
'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 vsetest & copied the demo files from uvadm - as documented on pages '1C1' & '1C2'
#2. You have converted the vsetest copybooks - from cpy0 --> cpy1 --> cpy2 --> cpys - as documented on page '1D1'
#3. You have converted the vsetest COBOL programs - from cbl0 --> cbl1 --> cbl2 --> cbls - as documented on page '1D2' - '1D4'
#4. You have converted the vsetest 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 vsetest COBOL programs - from cbls --> cblx - as documented on page '1D5'
#6. You have linked the 'getparm.c' C subroutine with rts32 (cobrun) - as documented on page '3D1' - if you have not done this, simply *comment out the 'call "getparm"' on line 20 of cpys/testunix1.cpy & recompile (mfcbl1 unixtest.cbl).
#7. You are currently logged in as vsetest and in /home/vsetest The only subdirs required to run unixtest1 are: a. cblx - holds the compiled program 'testunix1.int' b. testdata/ar - holds the demo data file 'customer.master.indexed'
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
'testunix1' will display values for environmental variables JOBID, 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 JOBID, 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.
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
#1. export JOBID=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/ar/customer.master.indexed ==================================================
#5. cobrun cblx/testunix1 <-- execute the program =====================
JOBID 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
#1. export JOBID=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/ar/customer.master.indexedXXX <-- make BAD filename ===================================================== - see the File Error Status displayed below
#5. cobrun cblx/testunix1 <-- execute the program =====================
JOBID 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: testdata/customer.master.indexedXXX File Status = 35 3/053
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
Here are the JCL & converted Korn shell script required to execute the COBOL demo program car100.cbl. The JCL/script conversions are documented at VSEJCL.htm#1C1 (page 1C1 of Part1 in VSEJCL.doc).
// JOB JAR100 TEST VSE JCL CONVERSION TO UNIX/LINUX KORN SHELL 00000010 * EXECUTES COBOL CAR100 CUSTOMER NAME&ADDRESS LISTING 00000020 // DATE 03/20/08 *COBOL program has ACCEPT FROM DATE 00000030 // DLBL CUSTMAS,'AR.CUSTOMER.MASTER',,VSAM,CAT=UCAT01 00000040 // DLBL NALIST,'AR.CUSTOMER.NAMEADRS.LIST100',0,SD 00000050 // EXTENT SYS017,DYNWRK,1,0,1,10 00000060 // EXEC PGM=CAR100,SIZE=AUTO 00000070 /& 00000080
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
k#001 #!/bin/ksh k#002 ##JOB JAR100 TEST VSE JCL CONVERSION TO UNIX/LINUX KORN SHELL k#003 export JOBID2=JAR100; scriptpath="$0"; args="$*" k#004 if [[ -z "$JOBID1" ]]; then JOBID1=JAR100; fi; export JOBID1 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 jobset41 jobend41 jobabend41 logmsg1 logmsg2 stepctl41 exportfile k#008 autoload exportgen0 exportgen1 exportgenall exportgenx k#009 jobset41 # call function to setup: directory equates, UPSI, etc k#010 #jobset41 stores any restart step# in alias 'goto' k#011 goto k#012 S0000=A k#013 #1======================== begin step#S0010_CAR100 ========================= k#014 S0010=A k#015 JSTEP=S0010; ((XSTEP+=1)); SCC=0; LCC=0; k#016 logmsg1 "Begin Step $JSTEP CAR100 (#$XSTEP)" k#017 stepctl41 # test oprtr jcpause/jcclear k#018 export PROGID=CAR100 k#019 export PARM=""; k#020 exportfile SYSOUT $SYOT/${JOBID2}_${JSTEP}_${PROGID} k#021 logmsg1 " EXECUTES COBOL CAR100 CUSTOMER NAME&ADDRESS LISTING" k#022 export RUNDATE=03/20/08 k#023 exportfile CUSTMAS ar/customer.master k#024 exportfile NALIST ar/customer.nameadrs.list100 k#025 ## EXEC PGM=CAR100,SIZE=AUTO k#026 #3---------------------------------------------------------------------- k#027 cobrun $ANIM $RLX/car100 k#028 #4---------------------------------------------------------------------- k#029 LCC=$?; S0010C=$LCC; ((SCC+=LCC)); ((JCC+=LCC)); alias goto=""; k#030 if ((SCC != 0)) k#031 then logmsg1 "step $JSTEP CAR100 abterm $SCC" k#032 alias goto="<<S9900=A"; fi k#033 goto k#034 #8====================================================================== k#035 S9000=A k#036 jobend41 #move any GDG files from jobtmp/subdirs to RUNDATA/subdirs k#037 uvtime W1D4 $JTMP/jobend $JTMP/jobbgn $JTMP/jobtimes k#038 logmsg1 "EOJ Normal, StepsExecuted=$XSTEP, LastStep=$JSTEP" k#039 exit 0 #UVSI jclunix41 ver: 20080502 options: d0e1j1l1p0r0s0t12u1y0 k#040 #9====================================================================== k#041 S9900=A k#042 uvtime W1D4 $JTMP/jobend $JTMP/jobbgn $JTMP/jobtimes k#043 logmsg2 "Terminated Abnormally,JCC=$JCC,StepsExec=$XSTEP,Last=$JSTEP" RV ACK k#044 exit $JCC
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
#1. jar100.ksh <-- command to execute JCL/script & COBOL program ==========
JAR100:040428:202302: JOB begun JAR100:040428:202302: RUNDATA=/home/vsetest/testdata RUNLIBS=/home/vsetest JAR100:040428:202302: TAPE=tape,WRK=wrk,RPTS=rpts/040428 JAR100:040428:202302: step# 1/1 car100 begun JAR100:040428:202302: file: CUSTMAS=ar/customer.master JAR100:040428:202302: file: NALIST=ar/customer.nameadrs.list100 JAR100:040428:202302: JOB=JAR100 Terminated Normally
#2. uvhd testdata/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 |
|
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
#3. vi testdata/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
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 '2H1'.
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
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.
identification division. * car300 - test mainframe conversion to micro focus cobol * - see cobolcnv.htm, mvsjcl.htm, vsejcl.htm * - 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.
See the JCL/script used to execute this program, listed on the next page --->
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
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 VSEJCL.htm to see those details.
// JOB JAR300 * TEST VSE JCL & COBOL CONVERSION - SYSIN & SYSOUT * - ctl/cobdirectives includes -C INDD "SYSIN" & -C OUTDD "SYSOUT" * - program CAR300 tests ACCEPT from SYSIN & DISPLAY UPON SYSOUT // EXEC CAR300 01 sysin test data line #01 02 sysin test data line #02 03 sysin test data line #03 /* /&
logmsg1 "Begin Step $JSTEP car300 (#$XSTEP)" export PROGID=car300 logmsg1 " TEST VSE JCL & COBOL CONVERSION - SYSIN & SYSOUT " logmsg1 "- ctl/cobdirectives includes -C INDD "SYSIN" & -C OUTDD "SYSOUT" " logmsg1 "- program CAR300 tests ACCEPT from SYSIN & DISPLAY UPON SYSOUT " exportfile SYS011 $JTMP/${JSTEP}_${PROGID} cat > $SYS011 <</*EOD 01 sysin test data line #01 02 sysin test data line #02 03 sysin test data line #03 /*EOD ## EXEC CAR300 cobrun $ANIM $RLX/car300
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.
Above conversion shows 'SYS011' (vs SYSIN) to read embedded data cards, because this customer's programs had 'select assign sys011' to read embedded data cards (vs ACCEPT from instream).
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
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.
:-----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 (cnvcob4.tbl/cnvcob5.tbl, cobdirectives)
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
Here are the conversion Operating Instructions with changes to include the 'sysin1' & 'sysout1' utility jobs.
#2. uvcopyx cleanup cbl0 cbl1 uop=q0i7c5e15g8j1k1l3n1s8t1w4,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
#3a. uvcopy cnvMF4,fild1=cbl1,fild2=cbl2,fili3=ctl/cnvcob4.tbl,uop=q0i7m1 *VSE* ==================================================================== - convert VSE COBOL programs for Unix/Linux Micro Focus compiler
#3b. uvcopy cnvMF5,fild1=cbl1,fild2=cbl2,fili3=ctl/cnvcob5.tbl,uop=q0i7m1 *MVS* ==================================================================== - 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
identification division. * car300 - test mainframe conversion to micro focus cobol * - see cobolcnv.htm, mvsjcl.htm, vsejcl.htm * - 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 "JOBID" 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
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
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. | PARM data retrieval alternate solution |
- demo with C subroutine 'getparm.c' linked with COBOL program 'car140.cbl' | |
- not as good as 3D1 since we cannot animate fully linked programs |
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
'ACCEPT FROM DATE' does not work the same on unix/linux as on VSE.
ON VSE the JCL could use '// DATE' to set a date that would be delivered by COBOL 'ACCEPT FROM DATE'.
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' ================
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 ? ====================
The JCL 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'.
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
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' |
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 MVSJCL.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
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
// JOB ...,DATE=... <-- mainframe MVSJCL 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
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#8G1 - 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
// JOB JAR110 TEST VSE 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
#!/bin/ksh ##JOB JAR110 TEST VSE JCL CONVERSION TO UNIX/LINUX KORN SHELL export JOBID2=JAR110; scriptpath="$0"; args="$*" if [[ -z "$JOBID1" ]]; then JOBID1=JAR110; fi; export JOBID1 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 jobset41 jobend41 jobabend41 logmsg1 logmsg2 stepctl41 exportfile autoload exportgen0 exportgen1 exportgenall exportgenx jobset41 # call function to setup: directory equates, UPSI, etc #jobset41 stores any restart step# in alias 'goto' goto S0000=A #1======================== begin step#S0010_CAR110 ========================= S0010=A JSTEP=S0010; ((XSTEP+=1)); SCC=0; LCC=0; logmsg1 "Begin Step $JSTEP CAR110 (#$XSTEP)" stepctl41 # test oprtr jcpause/jcclear export PROGID=CAR110 export PARM=""; export RUNDATE=03/20/08 <-- converted from // DATE *********** logmsg1 " DEMO set 'run-date' different from 'system-date'" 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 ar/customer.master exportfile NALIST ar/customer.nameadrs.list110 ## EXEC PGM=CAR110,SIZE=AUTO #3---------------------------------------------------------------------- cobrun $ANIM $RLX/car110 #4---------------------------------------------------------------------- LCC=$?; S0010C=$LCC; ((SCC+=LCC)); ((JCC+=LCC)); alias goto=""; if ((SCC != 0)) then logmsg1 "step $JSTEP CAR110 abterm $SCC" alias goto="<<S9900=A"; fi goto #8====================================================================== S9000=A jobend41 #move any GDG files from jobtmp/subdirs to RUNDATA/subdirs uvtime W1D4 $JTMP/jobend $JTMP/jobbgn $JTMP/jobtimes logmsg1 "EOJ Normal, StepsExecuted=$XSTEP, LastStep=$JSTEP" exit 0 #UVSI jclunix41 ver: 20080321 options: d0e1j1l1p0r0s0t12u1y0 #9====================================================================== S9900=A uvtime W1D4 $JTMP/jobend $JTMP/jobbgn $JTMP/jobtimes logmsg2 "Terminated Abnormally,JCC=$JCC,StepsExec=$XSTEP,Last=$JSTEP" RV ACK exit $JCC
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
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 ...'.
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.
* 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
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'.
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.
#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
#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
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.
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. 05 PARM-LTH PIC 9(4) COMP. 05 PARM-STRING PIC X(100). PROCEDURE DIVISION USING PARM-DATA.
Here are the equivalents of the above after conversion using the Vancouver Utility JCL & COBOL converters:
export PARM="MARCH 11, 2005" cobrun $ANIM $RLX/car120
working-storage section. uvM copy "unixwork1.cpy". * linkage section. 01 parm-data. 05 parm-lth pic 9(4) comp. 05 parm-string pic x(100). * procedure division using parm-data. uvM perform unixproc1. uvP move parm1-lth to parm-lth. uvP move parm1-data to parm-string.
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
linkage section. 01 parm-data. 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-group. <-- was parm-string
01 unixwork1. ........... 05 parm1-lth pic s9(4). <-- 4 bytes num char 05 parm1-data pic x(200).
3C3. | car120.cbl - COBOL program to demo parm-data conversions |
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
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 parm1-lth & parm1-data in working-storage * - converter inserts 'MOVE's to linkage section *note - may need to modify, since only 1st parm-data field moved program-id. car120. 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(65) value spaces. 01 cm1-eof pic x value ' '. * linkage section. 01 parm-data. 05 parm-lth pic 9(4) comp. 05 parm-string pic x(100). * procedure division using parm-data. uvM perform unixproc1. uvP move parm1-lth to parm-lth. uvP move parm1-data to parm-string. *note - cobol converter inserts 'PERFORM UNIXPROC1' here * - also inserts move parm-data/lth from w/s to l/s * - see parm-data/lth explanations lines 2-10 above
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
mainline. open input custmas. open output nalist. move parm-string 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
We will follow the test procedures documented on page 1J1 of VSEJCL.htm#1J1. Those documents setup vsetest user & copy the test/demo JCLs/programs from /home/uvadm/vsetest/* to /home/vsetest/...
Refer to page VSEJCL.htm#1A1 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 VSEJCL.htm#1J3 thru 1J6.
The COBOL program conversions have already been documented on page '2C1' of this document (VSECOBOL.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 vsetest --> /home/vsetest
#1. cnvMF41 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 ar/customer.nameadrs.list120 <-- inspect the output report =============================== - note date in page hdng from PARM=...
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
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 |
|
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 vsetest or vsetest) |
#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 |
|
#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
/* 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 retrieve data from JCL PARM=... to the COBOL program */ /* - see sample calling program CAR130 at www.uvsoftware.ca/vsecobol.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
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
We will follow the test procedures documented on page 1J1 of VSEJCL.htm#1J1. Those documents setup vsetest user & copy the test/demo JCLs/programs from /home/uvadm/vsetest/* to /home/vsetest/...
Refer to page VSEJCL.htm#1A1 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 VSEJCL.htm#1J3 thru 1J6.
The COBOL program conversions have already been documented on page '2C1' of this document (VSECOBOL.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 vsetest --> /home/vsetest
#1. cnvMF41 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 ar/customer.nameadrs.list130 <-- inspect the output report =============================== - note date in page hdng from PARM=...
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
/* 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 retrieve 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
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).
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
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
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 to executable binaries for 2 reasons:
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
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 vsetest --> /home/vsetest/ ============= 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 $RLX/car140 to --> $RLX/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 $RLX/car140' to just '$RLX/car140' to execute the fully linked program (car140 no extension) vs using cobrun to interpret car140.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
export PARM="MARCH 14, 2005" logmsg " CUSTOMER N & A LIST WITH DATE FROM GETPARM.C LINKED COBOL PROGRAM " exportfile CUSTMAS ar/customer.master exportfile NALIST ar/customer.nameadrs.list140 export SYSOUT=$RPTS/${JOBID}_${JOBSTEP}_${PROGID} export SYSIN=tmp/${JOBID}_${JOBSTEP}_${PROGID} cat > tmp/${JOBID}_${JOBSTEP}_${PROGID} <</*EOD FISCALYEAR=2004 /* /*EOD ## EXEC PGM=CAR140,SIZE=AUTO,PARM="MARCH 14, 2005" #3---------------------------------------------------------------------- ## cobrun $ANIM $RLX/car140 #<-- cobrun removed to execute linked program <--NB $RLX/car140 #<-- execute linked cobol program (vs .int) <--NB #4----------------------------------------------------------------------
JAR140:050312:204435: JOB begun JAR140:050312:204435: RUNDATA=/home/vsetest/testdata RUNLIBS=/home/vsetest JAR140:050312:204435: TAPE=tape,WRK=wrk,RPTS=rpts/050312 JAR140:050312:204435: step# 1/1 car140 begun JAR140:050312:204435: CUSTOMER N & A LIST WITH DATE FROM GETPARM.C LINKED COBOL PROGRAM JAR140:050312:204435: file: CUSTMAS=ar/customer.master JAR140:050312:204435: file: NALIST=ar/customer.nameadrs.list140 V4.0 revision 0 build 10/10/2 G; 11704. Run Time System RXCTO/AA0/00000A JAR140:050312:204435: JOB=JAR140 Terminated Normally
Not sure why we are getting the 'V4.0 ...' message, which we did not get when we executed the '.int' version of the program ??
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
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:
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:
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
#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 $RLX/car115 to --> $RLX/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 ar <-- observe report output created ======== (ar/customer.nameadrs.list115)
Note that in #3 above, we manually changed 'cobrun $ANIM $RLX/car115' to just '$RLX/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
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
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
#!/bin/ksh ##JOB JAR115 TEST VSE JCL CONVERSION TO UNIX/LINUX KORN SHELL export JOBID2=JAR115; scriptpath="$0"; args="$*" if [[ -z "$JOBID1" ]]; then JOBID1=JAR115; fi; export JOBID1 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 jobset52 jobend51 jobabend51 logmsg1 logmsg2 stepctl51 autoload exportfile exportgen0 exportgenall autoload exportgen1 exportgenx jobset51 # call function for JCL/script initialization goto S0000=A #1======================== begin step#S0010_CAR115 ========================= S0010=A JSTEP=S0010; ((XSTEP+=1)); SCC=0; LCC=0; logmsg2 "******** Begin Step $JSTEP car115 (#$XSTEP) ********" export PROGID=CAR115 export PARM=""; exportfile SYSOUT $SYOT/${JOBID2}_${JSTEP}_${PROGID} logmsg1 "demo calling COBOL sub-program (getdate.cbl) from archive called.a" logmsg1 "- could accept date in COBOL, but this demos mfcbl1o & mfcbl1x" logmsg1 "- might need to replace called assemblers with COBOL" logmsg1 "- see www.uvsoftware.ca/vsecobol.htm#3G1" exportfile CUSTMAS ar/customer.master exportfile NALIST ar/customer.nameadrs.list115 ## EXEC PGM=CAR115,SIZE=AUTO logmsg2 "Executing--> cobrun $ANIM $RLX/car115" #3---------------------------------------------------------------------- $RLX/car115 #4---------------------------------------------------------------------- LCC=$?; S0010C=$LCC; ((SCC+=LCC)); ((JCC+=LCC)); alias goto=""; if ((SCC != 0)) then logmsg2 "ERR: step $JSTEP CAR115 abterm $SCC" alias goto="<<S9900=A"; fi goto #8====================================================================== S9000=A jobend51 #move any GDG files from jobtmp/subdirs to RUNDATA/subdirs logmsg2 "EOJ Normal, StepsExecuted=$XSTEP, LastStep=$JSTEP" exit 0 #UVSI jclunix41 ver: 20100328 options: d0e1g1i3j1l1p0q1r0s0t12u1y0 #9====================================================================== S9900=A logmsg2 "ERR: Terminated Abnormally,JCC=$JCC,StepsX/L=$XSTEP/$JSTEP" RV ACK jobabend51 #report GDGs NOT moved from jobtmp/JOBID/GDG to outdirs exit $JCC
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
100331:181050:JAR115: Begin Job=JAR115 100331:181050:JAR115: /home/vsetest/testlibs/jcls/jar115.ksh 100331:181050:JAR115: Arguments: 100331:181050:JAR115: RUNLIBS=/home/vsetest/testlibs 100331:181050:JAR115: RUNDATA=/home/vsetest/testdata 100331:181050:JAR115: JTMP=jobtmp/JAR115 SYOT=sysout/JAR115 100331:181050:JAR115: RUNDATE=20100331 100331:181050:JAR115: ******** Begin Step S0010 car115 (#1) ******** 100331:181050:JAR115: file: SYSOUT=sysout/JAR115/JAR115_S0010_CAR115 bytes= 100331:181050:JAR115: demo calling COBOL sub-program (getdate.cbl) from archive called.a 100331:181050:JAR115: - could accept date in COBOL, but this demos mfcbl1o & mfcbl1x 100331:181050:JAR115: - might need to replace called assemblers with COBOL 100331:181050:JAR115: - see www.uvsoftware.ca/vsecobol.htm#3G1 100331:181050:JAR115: file: CUSTMAS=ar/customer.master bytes=8192 100331:181050:JAR115: file: NALIST=ar/customer.nameadrs.list115 bytes=2860 100331:181050:JAR115: Executing--> cobrun -F /home/vsetest/testlibs/cblx/car115 100331:181050:JAR115: Job Times: Begun=18:10:50 End=18:10:50 Elapsed=00:00:00 100331:181050:JAR115: EOF filr01 rds=10 size=20480: /home/vsetest/testdata/ctl/gdgctl51I 100331:181050:JAR115: EOJ Normal, StepsExecuted=1, LastStep=S0010
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
Micro Focus COBOL provides for file & record locking via the 'LOCK MODE IS ...' clause on the SELECT statement. Here are a few possibilities:
Here we will test only the default (EXCLUSIVE except for OPEN INPUT). We will use the following COBOL program & JCLs:
// JOB JAR150 TEST/DEMO VSE JCL ACCEPT DATE FROM CONSOLE * - CUSTOMER NAME & ADDRESS LISTING WITH DATE FROM CONSOLE * - USE TO TEST FILE I/O LOCKING WHEN 1 JOB WAITING FOR ENTRY * - WHILE THIS JAR150 WAITING FOR DATE ENTRY, RUN JAR155 & OBSERVE LOCK // DLBL CUSTMAS,'AR.CUSTOMER.MASTER',,VSAM,CAT=UCAT01 // DLBL NALIST,'AR.CUSTOMER.NAMEADRS.LIST150',0,SD // EXTENT SYS017,DYNWRK,1,0,1,10 // EXEC PGM=CAR150,SIZE=AUTO, 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
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) ==========
JAR155:050329:095210: JOB begun JAR155:050329:095210: RUNDATA=/home/vsetest/testdata RUNLIBS=/home/vsetest JAR155:050329:095210: TAPE=tape,WRK=wrk,RPTS=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=ar/customer.master JAR155:050329:095210: file: NALIST=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
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
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. 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 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(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. uvM perform unixproc1. 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. uvM stop run returning 0. 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
#!/bin/ksh ##JOB JAR150 TEST/DEMO VSE JCL ACCEPT DATE FROM CONSOLE export JOBID2=JAR150; scriptpath="$0"; args="$*" if [[ -z "$JOBID1" ]]; then JOBID1=JAR150; fi; export JAR150 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 jobset41 jobset42 logmsg1 logmsg2 exportfile stepctl41 stepctl42 jobset41 # call function to setup: directory equates, UPSI, etc #jobset41 stores any restart step# in alias 'goto' goto S0000=A #1========================== begin step#S0010 CAR150 =========================== S0010=A JSTEP=S0010; ((XSTEP+=1)); SCC=0; LCC=0; logmsg1 "Begin Step $JSTEP car150 (#$XSTEP)" stepctl41 # test oprtr jcpause/jcclear export PROGID=car150 export PARM=""; exportfile SYSOUT $SYOT/${JOBID2}_${JSTEP}_${PROGID} logmsg1 " - CUSTOMER NAME & ADDRESS LISTING WITH DATE FROM CONSOLE " logmsg1 " - USE TO TEST FILE I/O LOCKING WHEN 1 JOB WAITING FOR ENTRY " logmsg1 " - WHILE JAR150 WAITING FOR DATE ENTRY, RUN JAR155 & OBSERVE LOCK " exportfile CUSTMAS ar/customer.master exportfile NALIST ar/customer.nameadrs.list150 exportfile SYS011 $JTMP/${JSTEP}_${PROGID} cat > $SYS011 <</*EOD FISCALYEAR=2004 /*EOD ## EXEC PGM=CAR150,SIZE=AUTO #3---------------------------------------------------------------------- cobrun $ANIM $RLX/car150 #4---------------------------------------------------------------------- LCC=$?; S0010C=$LCC; ((SCC+=LCC)); ((JCC+=LCC)); alias goto=""; if ((SCC != 0)) then logmsg1 "step $JSTEP car150 abterm $SCC" alias goto="<<S9900=A"; fi goto #8====================================================================== S9000=A uvtime W1D4 $JTMP/jobend $JTMP/jobbgn $JTMP/jobtimes logmsg1 "EOJ Normal, StepsExecuted=$XSTEP, LastStep=$JSTEP" exit 0 #UVSI jclunix41 version: 20060206 options: d0e1j1l1p0r0t7u1y1 #9====================================================================== S9900=A uvtime W1D4 $JTMP/jobend $JTMP/jobbgn $JTMP/jobtimes logmsg1 "Terminated Abnormally,JCC=$JCC,StepsExctd=$XSTEP,LastStep=$JSTEP" RV reply=n; until [[ "$reply" = y ]] do logmsg1 "acknowledge AbTerm y "; read reply; done exit $JCC
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
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
Note |
|
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 (MVSJCL,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.
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.htm#1A1 Profiles
stub_profile |
|
common_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
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.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.htm#3A1 cross-refs summary
CNVaids.htm#3B1 - xrefall generate ALL Cross-Ref reports
CNVaids.htm#3B2 - xref... generate any 1 Cross-Ref report
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
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
statallmvs1 |
|
statallvse1 |
|
statmvsjcl1 |
|
statvsejcl1 |
|
statksh1 |
|
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.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.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.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.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.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.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.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
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 'vsetest' 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. | profile for Unix/Linux |
- profiles supplied at /home/uvadm/env/... | |
- recommended 'stub' profile in user homedirs, which calls a 'common' | |
profile in /home/appsadm/env (easy maintenance, changes in 1 place). | |
- 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 'jobset41' 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 the profile. |
9A1. | profile for SFU under Windows XP. |
- supplied at /home/uvadm/env/profile_SFU & listed in Part_9 |
5B1. | search/replace table for COBOL conversion (ctl/cnvcob.tbl listed below) |
- supplied at /home/uvadm/ctl/... or /home/uvadm/vsetest/ctl/... |
5C1. | scripts to convert COBOL programs (cpyrcs1A,cnvMF4A,cnvMF41) |
- supplied at /home/uvadm/sf/IBM/... |
5D1. | Compile Options control file (ctl/cobdirectives listed below) |
- supplied at /home/uvadm/ctl/... or /home/uvadm/vsetest/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
/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/...
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
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
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
export UVLPDEST="-dlp0" <-- change 'lp0' to your laser printer =======================
Note |
|
export COBDIR=/home/cobadm/cobol <-- change for your site ================================
Note |
|
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 JCL 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
'cnvMF4' is the uvcopy job that performs COBOL conversions for VSE COBOL. '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.
For the 1st trial conversion, you can copy the supplied table from 'uvadm' to your conversion libraries, for example:
cp /home/uvadm/ctl/cnvcob4.tbl ctl <-- for VSE ==================================
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.
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
# cnv/cnvcob4.tbl - search/replace table for cobol convert job (cnvMF4) # - see complete detail in part 3 of IBM2unix.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 developed at old 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 # # Jan06/10 - entries added for Everis (to #line below) examine ~~~~~~~~~~~~~~~~~~~~~ inspect ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ tallying all ~~~~~~~~~~~~~~~~ tallying tally for all ~~~~~~~~~~~~~~~~~~~~~~~~~~ tallying all ~~~~~~~~~~~~~~~ tallying tally for all ~~~~~~~~~~~~~~~~~~~~~~~~~~ true;~~~~~~~~~~~~~~~~~~~~~~~~ true1;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ false;~~~~~~~~~~~~~~~~~~~~~~~ false1;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ as;~~~~~~~~~~~~~~~~~~~~~~~~~~ as1;~~~~~~~~~~~~~~~~~~~~~~~~~= pic ~~~~~~~~~~~~~~ pointer;~~~~~~~~~~~~~~~~~~~~~ pointer1;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ (pointer;~~~~~~~~~~~~~~~~~~~~~(pointer1;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ disp;~~~~~~~~~~~~~~~~~~~~~~~~ disp1;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ (disp;~~~~~~~~~~~~~~~~~~~~~~~~(disp1;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # need duplicate for (subscripts) - since no blank at begin word not is ~~~~~~~~~~~~~~~~~~~~~~ not ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ manual;~~~~~~~~~~~~~~~~~~~~~~ manual1;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ text;~~~~~~~~~~~~~~~~~~~~~~~~ text1;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ day-of-week;~~~~~~~~~~~~~~~~~ day-of-week1;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ super;~~~~~~~~~~~~~~~~~~~~~~~ super1;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ terminal;~~~~~~~~~~~~~~~~~~~~ terminal1;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # next-page;~~~~~~~~~~~~~~~~~~~ page;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ upon conslog;~~~~~~~~~~~~~~~~ upon console;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ disk;~~~~~~~~~~~~~~~~~~~~~~~~ disk1;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ name;~~~~~~~~~~~~~~~~~~~~~~~~ name1;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ test;~~~~~~~~~~~~~~~~~~~~~~~~ test1;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ class;~~~~~~~~~~~~~~~~~~~~~~~ class1;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ escape;~~~~~~~~~~~~~~~~~~~~~~ escape1;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ignore;~~~~~~~~~~~~~~~~~~~~~~ ignore1;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ crt;~~~~~~~~~~~~~~~~~~~~~~~~~ crt1;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ auto;~~~~~~~~~~~~~~~~~~~~~~~~ auto1;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ previous;~~~~~~~~~~~~~~~~~~~~ previous1;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ disp;~~~~~~~~~~~~~~~~~~~~~~~~ disp1;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ cycle;~~~~~~~~~~~~~~~~~~~~~~~ cycle1;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ row;~~~~~~~~~~~~~~~~~~~~~~~~~ row1;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ col;~~~~~~~~~~~~~~~~~~~~~~~~~ col1;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ beep;~~~~~~~~~~~~~~~~~~~~~~~~ beep1;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ range;~~~~~~~~~~~~~~~~~~~~~~~ range1;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ timeout;~~~~~~~~~~~~~~~~~~~~~ timeout1;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ wait;~~~~~~~~~~~~~~~~~~~~~~~~ wait1;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ title;~~~~~~~~~~~~~~~~~~~~~~~ title1;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .99dr.~~~~~~~~~~~~~~~~~~~~~~~~.99db.~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ segment;~~~~~~~~~~~~~~~~~~~~~ segment1;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ (segment;~~~~~~~~~~~~~~~~~~~~~(segment1;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ cd;~~~~~~~~~~~~~~~~~~~~~~~~~~ cd1;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ (cd;~~~~~~~~~~~~~~~~~~~~~~~~~~(cd1;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ table;~~~~~~~~~~~~~~~~~~~~~~~ table1;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ message;~~~~~~~~~~~~~~~~~~~~~ message1;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ printer;~~~~~~~~~~~~~~~~~~~~~ printer1;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ reading; ~~~~~~~~~~~~~~~~~~~~ reading1; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ writing; ~~~~~~~~~~~~~~~~~~~~ writing1; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ id division~~~~~~~~~~~~~~~~~~ identification division~~~~~~~~~~~~~~~~~~~~~~~~~~ current-date;~~~~~~~~~~~~~~~~ rundate-mdy6e;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ time-of-day~~~~~~~~~~~~~~~~~~ systime-hms6~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~=============(end of table#1 marker '~~' in col 1&2)========================== # - current-date & time-of-day replaced by rundate-mdy6 & systime-hms6 because: # - current-date on unix Micro Focus COBOL is system date yymmdd # - vs mainframe where it could be set by JCL // SET DATE ... # - rundate-mdy6 defined in unixwork1.cpy inserted in W-S by VU COBOL converter # - rundate-mdy6 derived from $RUNDATE if exported in ksh script (dflt SYSDATE) # - see unixwork1.cpy & unixproc1.cpy at www.uvsoftware.ca/vsecobol.htm#2E1 # -----------------------------------------------------------------------------
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
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 '*' indicates scripts that are listed on following pages.
*cpyrcs1A - extract rcsz from COBOL copybook maps file
*cnvMF41 - convert 1 VSE 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
*cnvMF4A - convert All VSE programs (cbl0->cbl1->cbl2) - you would then manually----> cp cbl2/* cbls - and compile all programs---> mfcbl4A all
cnvMF41c - convert 1 VSE copybook: cpy0-->cpy1-->cpy2-->cpys
cnvMF51 - convert 1 MVS program at a time (cbl0->cbl1->cbl2->cbls->cblx)
cnvMF5A - convert All MVS programs (cbl0->cbl1->cbl2)
The initial conversions should be performed 'ALL programs in directory' but after that cnvMF41/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.
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
#!/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
#!/bin/ksh # cnvMF41 - 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 op. instrns. at www.uvsoftware.ca/vsecobol.htm#Part_2 #Jan06/10 - if no .extnsn spcfd: select last matching program # - for Everis with multiple version dates spcfd in .extnsn # print "\ncnvMF41 convert 1 program at a time (vs cnvMF4A for All programs)" print "cbl0------->cbl1------->cbl2---------> cbl3 ------->cbls--------->cblx" print " cleanup convert instream->SYSIN copy ? compile ?\n" # if [[ -d cbl0 && -d cbl1 && -d cbl2 && -d cbl3 && -d cbls && -d ctl && -d tmp ]] then : else echo "must have subdirs: cbl0,cbl1,cbl2,cbl3,cbls,ctl,tmp";exit 9;fi # if [[ -f ctl/cnvcob4.tbl && -f ctl/cpyrcs1I ]]; then echo "ctl/cnvcob4.tbl & ctl/cpyrcs1I must exist" echo "cpyrcs1I must have been created previously by cpyrcs1A" echo "cpyrcs1A extracts record-sizes from copybooks & loads Indexed file" echo " for COBOL converter to correct 01 record/copybook conflicts" echo "- see www.uvsoftware.ca/vsecobol.htm#1D2"; exit 9; fi # d1=${1%%/*}; p1=${1##*/}; p0=$p1 # extract directory/ & /filename # if no .extension spcfd - find last matching file & add back '.cbl' extnsn if [[ "$p1" != *.* ]]; then for dp1 in $d1/$p1* do p0=${dp1##*/} # drop directory/ done p1=$p1.cbl # add .cbl extension to last matching file fi # if [[ ! -f "$d1/$p0" ]]; then echo "usage: cnvMF41 cbl0/program <-- arg1 programname (in subdir cbl0)" echo " ====================" echo "ex: cnvMF41 cbl0/CAR100.cbl <-- cbl0 names UPPERcase .ext or not" echo " =======================" echo " cnvMF41 cbl1/car100 <-- .cbl extnsn added if omitted" echo " =================== - also finds last matching basename" exit 9; fi # typeset -l p2=$p1 # ensure output filename lower case # if program name does not have .cbl extension - add it now # if [[ $p2 != *.cbl ]]; then p2=$p2.cbl; fi # echo "Next step calls CLEANUP job with options defaulted for most sites" echo "- see cleanup options at: www.uvsoftware.ca/vsecobol.htm#4I1" clop1="q0i7c5e15g8j1k1l1n1s8t1w4" 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=$d1/$p0,filo1=cbl1/$p2,uop=$clop1$clop2,arg1=.cbl #===================================================================== # - see above options explained in uvcopy job (uvadm/pf/cleanup) # 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 "l3 (default) - uses keywords in filenames to set ORGANIZATION Line Seqntl" echo "l4 - use xref/cobfil45I to identify ORG LINE SEQNTL files" echo "l8 - force all sequential files ORGANIZATION LINE SEQUENTIAL" echo "v0 (default) - dont insert 'recording mode v' in FDs" echo "v1 - insert 'v' if match in ctl/dlbltyp42I created by uvcopy dlbltyp41" echo "Enter override options here or on next screen (or null accept defaults)" read ops2 # uvcopy cnvMF4,fild1=cbl1,fild2=cbl2,uop=q1i3a1$ops2,arg1=$p2\ ,fili3=ctl/cnvcob4.tbl,filr4=xref/cobfil45I,filr5=ctl/dlbltyp42I\ ,filr6=ctl/cpyrcs1I #================================================================ # reply=x; until [[ "$reply" = "y" || "$reply" = "n" ]] do echo "convert 'ACCEPT instream data' to 'read from SYSIN' file ? y/n" read reply; done if [[ "$reply" = "y" ]]; then uvcopy sysin1,fili1=cbl2/$p2,filo1=cbl3/$p2,uop=q0i7 #=================================================== else cp cbl2/$p2 cbl3/$p2; fi # echo "$p2 converted to cbl3, copy to cbls overwriting any prior & compile?" 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 cbl3/$p2 cbls # copy to final cobol source dir for compile & corrections #================== mfcbl1 $p2 #<-- attempt compile #========= exit 0
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
#!/bin/ksh # cnvMF4A - Korn shell script from UVSI stored in: /home/uvadm/sf/IBM/ # cnvMF4A - convert all VSE mainframe COBOL programs to Micro Focus COBOL # - see op. instrns. at www.uvsoftware.ca/vsecobol.htm#Part_2 # - also see cnvMF41 for 1 program at a time # if [[ "$1" != "all" ]]; then echo "usage: cnvMF4A all <--arg1 'all' cnvrt prgrms cbl0->cbl1->cbl2->cbl3" echo " ===========" exit 1; fi # echo "convert all COBOL programs y/n ?" echo "cbl0------>cbl1------>xref------->cbl2 ------->cbl3----->cbls------>cblx" echo " cleanup identify OLS convert ACCEPT->READ copy? compile ?" reply=x; read reply until [[ "$reply" = "y" || "$reply" = "n" ]] do echo "convert all programs: cbl0->cbl1->cbl2->cbl3->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 cbl3 && -d cbls && -d ctl && -d tmp ]] then : else echo "must have subdirs: cbl0,cbl1,cbl2,cbl3,cbls,ctl,tmp";exit 9;fi # reply=x; until [[ "$reply" = "y" || "$reply" = "n" ]] do echo "Also run cpyrcs1A y/n ? (n saves time if run previously)" echo "cpyrcs1A extracts record-sizes from copybooks & loads Indexed file" echo " for COBOL converter to correct 01 record/copybook conflicts" echo "(see www.uvsoftware.ca/vsecobol.htm#1D2) RUN NOW y/n ?" read reply; done if [[ "$reply" = "y" ]]; then cpyrcs1A maps #============ fi echo "enter to continue"; read reply # rm -f cbl1/* cbl2/* cbl3/* #<-- remove any old intermediate files #========================= # echo "Next step calls CLEANUP job with options defaulted for most sites" echo "- see cleanup options at: www.uvsoftware.ca/vsecobol.htm#4I1" clop1="q0i7c5e15g8j1k1l1n1s8t1w4" echo "default options=$clop1 (may enter overrides or null)" echo "example: enter 's0' to NOT clear columns 1-6 (overrides default s8)" read clop2 # uvcopyx cleanup cbl0 cbl1 uop=$clop1$clop2,arg1=.cbl #=================================================== # - cleanup mainframe code (clear 1-6, 73-80, lower case except in quotes) reply=x; until [[ "$reply" = "y" || "$reply" = "n" ]] do echo "generate ctl/cobfil45I to determine ORG Line Seqntl y/n ?" echo "- see Identify ORGANIZATION Line Seqntl & cnvMF4 option 'l4'" echo " at: https://www.uvsoftware.ca/vsecobol.htm#6G2" echo "alternatives for option 'l' (enter on next step) are:" echo " l3 (default) - use keywords in filenames to set ORG Line Seqntl" echo " l8 - force all sequential files ORGANIZATION LINE SEQUENTIAL" echo "generate ctl/cobfil45I to determine ORG Line Seqntl y/n ?" read reply; done; # if [[ $reply = "y" ]]; then uvcopy cobfil45,fild1=cbl1,filo2=xref/cobfil45a,uop=q0i7,rop=r0 #============================================================== # created sequential file cobol file info, now sort/load Indexed file # uvsort "fili1=xref/cobfil45a,rcs=100,typ=LST,filo1=xref/cobfil45I,typ=ISF\ ,key1=0(44),isk1=0(44),del1=0(1):*" #========================================================================= echo "created xref/cobfil45I to Identify ORG Line Seqntl files" 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 "y1 (default) - clear cols 1-6, specify 'y0' to retain (NOT clear)" echo "l3 (default) - uses keywords in filenames to set ORGANIZATION Line Seqntl" echo "l4 - use xref/cobfil45I to identify ORG LINE SEQNTL files" echo "l8 - force all sequential files ORGANIZATION LINE SEQUENTIAL" echo "v0 (default) - dont insert 'recording mode v' in FDs" echo "v1 - insert 'v' if match in ctl/dlbltyp42I created by uvcopy dlbltyp41" echo "Enter override options here or on next screen (or null accept defaults)" read ops2 # uvcopy cnvMF4,fild1=cbl1,fild2=cbl2,fili3=ctl/cnvcob4.tbl\ ,filr4=xref/cobfil45I,filr5=ctl/dlbltyp42I,filr6=ctl/cpyrcs1I,uop=q1i3$ops2 #========================================================================== # - convert mainframe COBOL to Micro Focus COBOL # reply=x; until [[ "$reply" = "y" || "$reply" = "n" ]] do echo "convert 'ACCEPT instream data' to 'read from SYS011' file ? y/n" read reply; done if [[ "$reply" = "y" ]]; then uvcopyx sysin1 cbl2 cbl3 uop=q0i7 #================================ else allcp cbl2 cbl3; fi # script 'allcp' allows > 8192 files # echo "cnvMF4A COBOL conversion complete (results in cbl3 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 "allcp cbl3 cbls <-- OR you could copy manually like this" echo "=============== (script 'allcp' if > 8192 files)" 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 allcp cbl3 cbls #<-- copy programs to compile subdir mfcblA all #<-- compile all programs to .int's elif [[ "$reply" = "g" ]] then allcp cbl3 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
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.
# 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=$RUNLIBS/ctl/cobdirectives # ======================================== -C VSC2(2) -C CASE -C FILESHARE -C IBMCOMP -C INDD(SYSIN) -C OUTDD(SYSOUT) -C LIST() -C FORM(56) -C PERFORM-TYPE(OSVS) -C SPZERO -C NOSEG -C SIGN(ASCII) -C SOURCEFORMAT(FIXED) -C NOMFCOMMENT # ** Database Directives ** # (uncomment 1 of the following & modify as required) # -C SQL(targetdb==ORACLEOCI) # -C "DB2(init==prot db==ar)" -C SQL(dbman==ODBC) # -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) # # ** 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
# 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 for COBOL by EXTFH, in profiles, for example: # # export UV=/home/uvadm <-- usual location of Vancouver Utilities # export EXTFH=$UV/ctl/extfh.cfg # # --- OR if you prefer, use following --- # export RUNLIBS=/home/mvstest/testlibs <-- change to your RUNLIBS # export EXTFH=$RUNLIBS/ctl/extfh.cfg # #--------------------------------------------------------------------------- # [XFH-DEFAULT] - following options apply to all files # - unless over-ridden by [INTERNAL:EXTNAME] (see below) # 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) # # 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) # # FILEPOINTERSIZE=8 - allow IDX8 files > 256 Terrabytes (dont need) # #--------------------------------------------------------------------------- # [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_ # #--------------------------------------------------------------------------- [XFH-DEFAULT] IDXNAMETYPE=2 # IDXFORMAT=8 #---------------------------------------------------------------------------
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
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 - see listing on page '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
#!/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"; # capture progname, default input subdir test -n "$2" && cbls="$2"; # if arg2 subdir spcfd - use it (vs dflt cbls) if [[ ! -f "$cbls/$pgm" ]]; then echo "USAGE: mfcbl1 progname.cbl [cbls]" echo " ===================" echo " mfcbl1 $pgm $cbls" echo " ==========================" echo " - arg1 progname mandatory, arg2 subdir defaults to cbls/" exit 1; fi # # specify copybook searchpath for MF COBOL cwd=$(pwd) # save Current Working Directory export COBCPY=$cwd/cpys # specify copybook search directory # - 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
#!/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 # # specify copybook searchpath for MF COBOL cwd=$(pwd) # save Current Working Directory export COBCPY=$cwd/$dc # specify copybook search directory # - 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 #
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
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 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
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 |
6G3. | 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
6J1. | Search/Replace tables to improve conversion |
6K1. | Update S/R tables, Re-convert,& Re-compile |
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 |
- cnvMF41c & cnvMF4Ac for copybooks, cnvMF41 & cnvMF4A 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
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 (vsetest) for convenience & simplicity.
/home :----user1 :----user2 :-----etc- :----vsetest <-- $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
/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/vsetest) which should not be used for your development & production because:
The next few pages will present the details of this 1st practical yet simple file system design. See alternative file designs in VSEJCL.htm#Part_5 that allow for multiple companies &/or multiple separate applications. VSEJCL.htm#Part_5 also discusses using RAID for your O/S & applications.
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
/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 - cnvMF4 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 - cnvMF4 converts mainframe COBOL to Micro Focus COBOL :-----cpys - copy here (standard copybook library) :-----ftp - subdir for FTP transfers :-UV--ctl - conversion control files (jclunixop41, datafiles41) :-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 :-----parms - PROC expansion searches parms for INCLUDEs :-----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)
vsetestdirs <-- script to create the directories shown above ===========
/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
/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).
/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
Note |
|
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
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 jobset41 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
p4/ :-----IBMlibs : :-----cbl : :-----cpy : :-----jcl : :-----proc : :-----ctlcdlib
/p4 :-----testlibs : :-----apay : : :-----cbl0 : : :-----cpy0 : : :-----jcl0 : : :-----proc0 : : :-----parm0 : :-----arcv : : :-----cbl0 : : :-----cpy0 : : :-----jcl0 : : :-----proc0 : : :-----parm0 : :-----ordr : : :-----cbl0 : : :-----cpy0 : : :-----jcl0 : : :-----proc0 : : :-----parm0
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
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 : :-----parm0 Control card library from mainframe : :-----parms - control cards 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
Library source (COBOL, JCL, SORT field members, etc) will be cleaned up prior to the actual conversion.
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
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 do not have filename 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
We need to ensure that our libraries are pure - no copybooks mixed in with programs, no JCLs mixed in with programs, etc.
The Vancouver Utilities provides utilities that can help you do this. For example uvcopy job 'scan4d' can scan all files in 'cb0' & report any that do not contain 'WORKING-STORAGE'.
#1. vi ctl/cblprogid.tbl <-- prepare table of patterns to scan for ==================== - example below
working-storage ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#2. uvcopy scan4d,fild1=cb0,fili2=ctl/scantable,filo3=tmp/notcbl.rpt =================================================================
Job: scan4d Dir: cbl0 Table: ctl/cblprogid.tbl Date: 2005/09/19_09:29:53 ======================================================================= working-storage ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ =========================================================================== File# 0005 Lines=0018 FileName=cbl0/autocrec.cpy
File# 0079 Lines=0022 FileName=cbl0/cdlexrec.cpy
File# 0085 Lines=0256 FileName=cbl0/clrinfo.cpy
File# 0093 Lines=0227 FileName=cbl0/dateparm.cpy
Total Files=0242 Files Reported=0004 =======================================================================
A new tool 'encode1' will soon be available that will scan any directory & append a suffix to indicate the module type (.cpy, .cbl, .jcl, etc).
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
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
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.
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:
/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
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
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 ===================
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
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 ===============
#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
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 ===================
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
#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
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
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
parm0 -------> parms 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, parm0). 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' is a uvcopy job to cleanup mainframe library modules prior to conversion for unix/linux. 'cleanup' has many options (as shown on page 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
These instructions convert ALL programs in the directory, a multi-step process through several directories:
cpy0 ---------> cpy1 --------> cpy2 --------> cpys cleanup convert copy(cp)
#1a. login: yourid --> your home dir
#1b. cdl --> /p1/testlibs <-- alias cdl='cd $RUNLIBS'
#2. uvcopyx cleanup cpy0 cpy1 uop=q0i7c5e6g8j1k2l1n1s8t1,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
#3. uvcopy cnvMF4,fild1=cpy1,fild2=cpy2,fili3=ctl/cnvcob4.tbl,uop=q0i7m2l0 ====================================================================== - convert VSE COBOL programs for Unix/Linux/SFU Micro Focus compiler
Note |
|
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
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)
#1. uvcopyx cleanup cbl0 cbl1 uop=q0i7c5e15g8j1k1l1n1s8t1w4,arg1=.cbl ================================================================= - cleanup mainframe code, remove CRs, clear cols 1-6 & 73-80, etc
The COBOL converter (cnvMF4) provides option 'l4' to lookup an indexed file to identify printer files as 'ORGANIZATION LINE SEQUENTIAL' on 'select' stmnts. Option 'l4' 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.
'uvcopy cobfil45' scans all COBOL programs looking for OLS criteria and writes a file (xref/cobfil45a) to identify these files keyed by programname & filename. 'uvsort' is then used to sort & load these records into an indexed file (xref/cobfil45I) for lookup by 'uvcopy cnvMF4'.
Note |
|
#2. uvcopy cobfil45,fild1=cbl1,filo2=xref/cobfil45a,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/cobfil45a,rcs=100,typ=LST,filo1=xref/cobfil45I,typ=ISF\ ,key1=0(44),isk1=0(44),del1=0(1):*" ========================================================================== - sort & load sequential file into indexed file for lookup by cnvMF4
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
#4a. uvcopy cnvMF4,fild1=cbl1,fild2=cbl2,fili3=ctl/cnvcob4.tbl\ =========================================================== ,fili4=xref/cobfil45I,fili5=ctl/dlbltyp42I,uop=q1i7m1l4 =======================================================
#4b. uvcopy cnvMF4 <-- same but easier, most defaults OK ============= - but enter option 'l4' (or 'l3') at prompt below
uop=q1a0c0d0j2l3m1p0r0u1vw10y1 - 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 c1 - translate copy-book-names to lower case c2 - translate copy-book-names to UPPER case c0 - do not change (already done by cobsup) d0 - leave ACCEPT from DATE as is d1 - cnvt ACCEPT DATE to env-var SYSDATE (Hadley dflt) j0 - inhibit jobstamp insert (for display on console) j2 - insert jobstamp "date:time:JOBID2: " display prefix l0 - do not insert ORG Line/Record Seqntl on selects l1 - insert OLS on selects matching cardfile keywords l2 - insert OLS on selects matching printerfile keywords l4 - use cobfil45I indexed file to test ORG Line Seqntl l8 - force all sequential files to ORG Line Seqntl m1 - module type = COBOL program m2 - module type = COBOL copybook p1 - convert positioning to advancing 1 line/page (also see optn p1 in cobfil45 & sysin1) r1 - convert 80 byte input files to OLS r2 - convert 132/133 byte output files to OLS u1 - insert copy unixwork1/unixproc1 & perform unixproc1 u2 - insert copy unixwork2/unixproc2 & perform unixproc2 v1 - lookup ctl/dlbltyp42I to insert mode v v0 - do not use ctlfile created by dlbltyp41+loadtyp42I w1 - gen move parm lth/data unixwork1 to LINKAGE section 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 = q1a0c0d0j2l3m1p0r0u1v0w1y1q1m1l4 null to accept or re-specify (1 or more) -->
'q1m1l4' are appended on the defaults since they were spcfd on the command line
option 'q1' |
|
option 'l4' |
|
option 'v1' |
|
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
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.
#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
#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)
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
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.
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 VSEJCL.htm to illustrate the entire conversion of COBOL & JCL, and then the execution of the JCL/scripts & programs. The default sub-directories are as follows:
cbls |
|
cpys |
|
cblx |
|
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
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 |
|
#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.
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
Here is a sample 'cobol compile failure report' created by the compile scripts mfcblA &/or mfcbl1, documented on the previous page.
#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
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
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 =========================
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 =========================
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
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 |
|
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
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.
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 (cnvcob4.tbl for VSE). See cnvcob4.tbl listed previously in this section.
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
'cnvMF4' is the uvcopy job that performs COBOL conversions for VSE 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.
For the 1st trial conversion, you can copy the supplied table from 'uvadm' to your conversion libraries, for example:
cp /home/uvadm/ctl/cnvcob4.tbl ctl <-- for VSE ==================================
These are search/replace conversion tables (see cnvcob4.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.
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
# cnv/cnvcob4.tbl - search/replace table for cobol convert job (cnvMF4) # - see complete detail in part 3 of VSECOBOL.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 # 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;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~=============(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
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 realist our Operating Instructions here in a concise manner, using script cnvMF4A. This script combine the multiple uvcopy conversion jobs (cleanup, cobfil45,& cnvMF4) into 1 script.
#1. vi ctl/cnvcob4.tbl <-- update search/replace table for COBOL converter ================== - see page '6J1'
#2. cnvMF4A 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.
The initial conversions should be performed 'ALL programs in directory' (using cnvMF4A), but after that cnvMF41 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. cnvMF41 cbl0/PROGRAMX.cbl <-- 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
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 cnvMF4/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 "JOBID" upon environment-name > uvJ accept jobid from environment-value. 34c37 < stop run. --- > uvM stop run returning 0.
Note |
|
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
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 VSE conversion job cnvMF4 vs cnvMF5 for MVS):
#1a. vi ctl/cnvcob4.tbl - modify the search/replace table #1b. vi pf/cnvMF4 - 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 cnvMF4 ... - reconvert COBOL programs with modified table &/or cnvMF4 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
Before you begin to test/debug, I strongly recommend that you consider the Cross-References documented in Part 9 of VSEJCL.htm#Part_9. 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 in VSEJCL.htm#Part_9.
#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 VSEJCL.htm#Part_9 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.
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
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
/p1/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 (jobset41,logmsg,etc) : :-----xref - cross-references (see Part_9)
/p1/testdata <-- $RUNDATA for programmers testing : :-----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
cnvMF41c 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
cnvMF4Ac all <-- reconvert All copybook in directory ============ cpy0 --> cpy1 --> cpy2 --> ?--> cpys - prompts to continue at various points --> copy UNIXWORK1 & UNIXPROC1 from /home/uvadm/vsetest/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
cnvMF41 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
cnvMF4A 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
'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:
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.
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 cobfil45' scans the programs for 'write advancing' & writes a control file, used by the COBOL converter (uvcopy cnvMF4) 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 'l4' on the uvcopy cnvMF4 command. If desired, you may specify 'l3', 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 'cnvMF4' 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
uvcopy table3d,fild1=cbl0,arg1=select <-- run table3d on COBOL subdir =====================================
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
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 -->
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
7A1. | Inserting 'recording mode v' into appropriate FD's |
- mainframe assumed if different recsizes under FD, or occurs depending | |
- Micro Focus COBOL requires 'recording mode v' explicitly |
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
>>>> to be supplied as of April 27, 2007 <<<<
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
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' | |
cblidx81.cbl - load IDXf8 Indexed file from text file | |
cblidx82.cbl - read IDXf8 Indexed file created by 'uxcp' | |
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 |
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
IDXFORMAT1 |
|
IDXFORMAT3 |
|
IDXFORMAT8 |
|
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.
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.
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.
dat1/idxtest --------------> dat2/idxf3Icbl -------------> dat3/idxf3Luxcp cblidx31 uxcp
dat1/idxtest ------------> dat2/idxf3Iuxcp -----------------> dat3/idxf3Lcbl uxcp cblidx32
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
You must have setup your profile as documented on pages '5A1' thru '5A3' or in install.htm or ADMjobs.htm.
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 on page '5A1' as shown below.
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 ==============================
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
Setup a separate directory for testing (could be a subdir in your homedir).
2a. mkdir uxcbltest <-- make directory for testing =============== 2b. cd uxcbltest <-- change into the directory ============
3a. mkdir cbls cblst cblx cpys ctl dat1 dat2 dat3 tmp =================================================
3b. uxcbltestdirs - OR run script provided to make subdirs =============
4a. cp /home/uvadm/ctl/cobdirectives ctl ==================================== 4b. cp /home/uvadm/ctl/extfh.cfg ctl ================================
5a. cp /home/uvadm/dat1/idxtest dat1 ================================
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 ========================================
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
$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
$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 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
0010.0060 idxtest text file to create Var Lth Indexed files 0020.0064 - input to COBOL & uxcp to create IDXFORMAT1,3,8 files 0030.0072 - 01-04=ISAM key, 05=.separator,06-09=recsize,10-400 text 0040.0076 - output record varies from 64 to 256 depending on recsize 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)..................... ===============================================================================>
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
dat1/idxtest --------------> dat2/idxf3Icbl -------------> dat3/idxf3Luxcp cblidx31 uxcp
1a. export FILE1=dat1/idxtest <-- specify input file =========================
1b. export FILE2=dat2/idxf3Icbl <-- specify output file ==========================
1c. cobrun cblx/cblidx31 <-- execute COBOL program ====================
2a. uxcp "fili1=dat2/idxf3Icbl,typ=IDXf3,rcs=256,filo1=dat3/idxf3Lux,typ=LSTt" ========================================================================== - OR use following script:
2b. uxcpIDXf3-LST <-- script alternative (same code as above) =============
3a. cat dat3/idxf3Luxcp ===================
0010.0060 idxtest text file to create Var Lth Indexed files 0020.0064 - input to COBOL & uxcp to create IDXFORMAT1,3,8 files 0030.0072 - 01-04=ISAM key, 05=.separator,06-09=recsize,10-400 text 0040.0076 - output record varies from 64 to 256 depending on recsize 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/idxf3Luxcp ================================= - verify that result is same as original input file (result of converting to IDXf3 by COBOL & back to LST by uxcp)
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
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~......0508281223150005082812231500.>.......................@.. 3700000033333333333333333333333333330300000000000000000009000400 0E00000005082812231500050828122315000E02000000001000000010000000 64 ............................................X"8*................ 0000000000000000000000000000000000000000000052320000000000000000 00000000000020100000000000000000000000000000828A0000000000000000 10 20 30 40 50 60 r# 2 0123456789012345678901234567890123456789012345678901234567890123 532 @<0010.0060 idxtest test file to create ISAM Variable length .. 4333332333326773522276772666627626766762454425676666626666762200 0C0010E00600936130D04534069C504F03251450931D0612912C50C5E7480000 10 20 30 40 50 60 r# 3 0123456789012345678901234567890123456789012345678901234567890123 596 @80020.0056 - input to 'cblidx31.cbl' & 'uxcp' .. 433333233332222222226677727622666677332666222227767222222200 080020E00560000000D09E05404F073F293611E3F2706075830700000000 10 20 30 40 50 60 r# 4 0123456789012345678901234567890123456789012345678901234567890123 656 @H0030.0072 01-04=ISAM key, 05=.separator,06-09=recsize,10-400 t 4433332333323323334544266722333276767676723323337667676233233327 080030E0072001D04D931D0B59C005DE3501214F2C06D09D25339A5C10D40004 64 ext .. 677222222200 584000000000 10 20 30 40 50 60 r# 5 0123456789012345678901234567890123456789012345678901234567890123 732 @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# 6 0123456789012345678901234567890123456789012345678901234567890123 812 @P0050.0080 - here is an 80 byte record------------------------- 4533332333322266762672662332677627666762222222222222222222222222 000050E00800D0852509301E080029450253F24DDDDDDDDDDDDDDDDDDDDDDDDD 64 ----------------->.. 22222222222222222300 DDDDDDDDDDDDDDDDDE00 - - - 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
dat1/idxtest ------------> dat2/idxf3Iuxcp -----------------> dat3/idxf3Lcbl uxcp cblidx32
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) =============
2a. export FILE1=dat2/idxf3Iuxcp <-- specify input file ============================
2b. export FILE2=dat3/idxf3Lcbl <-- specify output file ===========================
2c. cobrun cblx/cblidx32 <-- execute COBOL program ====================
3a. cat dat3/idxf3Lcbl ==================
0010.0060 idxtest text file to create Var Lth Indexed files 0020.0064 - input to COBOL & uxcp to create IDXFORMAT1,3,8 files 0030.0072 - 01-04=ISAM key, 05=.separator,06-09=recsize,10-400 text 0040.0076 - output record varies from 64 to 256 depending on recsize 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)
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
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/idxf3Iuxcp.dat v <-- display IDXf3 file (created by uxcp) =========================
10 20 30 40 50 60 r# 1 0123456789012345678901234567890123456789012345678901234567890123 0 0~......0508281223274905082812232749.>.......................<.. 3700000033333333333333333333333333330300000000000000000000000300 0E00000005082812232749050828122327490E02000000001000000010000C00 64 ............................................X"8*................ 0000000000000000000000000000000000000000000052320000000000000000 00000000000020100000000000000000000000000000828A0000000000000000 10 20 30 40 50 60 r# 2 0123456789012345678901234567890123456789012345678901234567890123 388 @<0010.0060 idxtest test file to create ISAM Variable length .. 4333332333326773522276772666627626766762454425676666626666762200 0C0010E00600936130D04534069C504F03251450931D0612912C50C5E7480000 10 20 30 40 50 60 r# 3 0123456789012345678901234567890123456789012345678901234567890123 452 @<0020.0056 - input to 'cblidx31.cbl' & 'uxcp' .. 4333332333322222222266777276226666773326662222277672222222222200 0C0020E00560000000D09E05404F073F293611E3F27060758307000000000000 10 20 30 40 50 60 r# 4 0123456789012345678901234567890123456789012345678901234567890123 516 @A0030.0072 01-04=ISAM key, 05=.separator,06-09=recsize,10-400 t 4433332333323323334544266722333276767676723323337667676233233327 010030E0072001D04D931D0B59C005DE3501214F2C06D09D25339A5C10D40004 64 ext. 6770 5840 10 20 30 40 50 60 r# 5 0123456789012345678901234567890123456789012345678901234567890123 584 @J0040.0076 - output record varies from 64 to 256 depending on r 4433332333322267777727666762767667267662332762333266766666626627 0A0040E00760D0F540540253F240612953062FD06404F025604505E49E70FE02 64 ecsize 06-09 667676233233 5339A5006D09 10 20 30 40 50 60 r# 6 0123456789012345678901234567890123456789012345678901234567890123 660 @P0050.0080 - here is an 80 byte record------------------------- 4533332333322266762672662332677627666762222222222222222222222222 000050E00800D0852509301E080029450253F24DDDDDDDDDDDDDDDDDDDDDDDDD 64 ----------------->.. 22222222222222222300 DDDDDDDDDDDDDDDDDE00 - - - 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
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
# cobdirectives - Directives for Micro Focus COBOL Server Express # - for batch compiles on Unix/Linux # of COBOL programs migrated from an IBM VSE mainframe # # This file is defined in the compile scripts mfcbl1 & mfcblA as follows: # # export COBOPT=$RUNLIBS/ctl/cobdirectives # ======================================== # -C VSC2(2) -C CASE -C FILESHARE -C IBMCOMP -C INDD(SYSIN) -C LIST() # -C OUTDD(SYSOUT) <-- disable for Laval, so all displays goto console -C PERFORM-TYPE(OSVS) -C SPZERO -C NOSEG -C NOTRUNC -C XREF -C SIGN(ASCII) -C SOURCEFORMAT(FIXED) #------------------------------------------------------------------------- # -C LIST() causes mfcbl1 & mfcblA scripts to leave source listing in cblst # -C SIGN(ASCII) <-- default recommended, SIGN(EBCDIC) not recommended # -C OUTDD(SYSOUT) requires fixpack40.02_11 on SX 4.0 SP1 # -C ANS85 <-- might use for MVS, use -C VSC2(2) for VSE # -C SETTINGS(COL3) # -C OSVS #-------------------------------------------------------------------------- # ** 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 Handler Configuration vs directives ** # # See extfh.cfg - File Handler Configuration file for Micro Focus COBOL # - stored at $RUNLIBS/ctl/extfh.cfg, sample contents might be: # # [XFH-DEFAULT] - following options apply to all files (unless specified dif) # IDXNAMETYPE=2 - '.dat' ext on data partition (& .idx on index part) # IDXFORMAT=8 - create all indexed files as IDX8 (allows > 2 gig) # FILEPOINTERSIZE=8 - allow IDX8 files > 256 Terrabytes (don't need) #------------------------------------------------------------------
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
# extfh.cfg - File Handler Configuration file for Micro Focus COBOL # - see https://supportline.microfocus.com/Documentation/books/sx40sp/fh... # - see www.uvsoftware.ca/vsecobol.htm & www.uvsoftware.ca/mvscobol.htm # location of this file defined for COBOL by EXTFH, in profiles, for example: # export RUNLIBS=/home/mvstest # export EXTFH=$RUNLIBS/ctl/extfh.cfg # # [XFH-DEFAULT] - following options apply to all files (unless specified dif) # IDXNAMETYPE=2 - '.dat' ext on data partition (& .idx on index part) # IDXFORMAT=8 - create all indexed files as IDX8 (allows > 2 gig) # FILEPOINTERSIZE=8 - allow IDX8 files > 256 Terrabytes (don't need) # # [INTERNAL:EXTNAME] - following options apply to a specific file # IDXFORMAT=1 - applies only to file named above # - defined by export EXTNAME=pathname for cobol select: # - select internalname assign external EXTNAME. # [INTERNAL:E212002] - example for file whose EXTNAME=E212002 (on select) # IDXFORMAT=3 - use IDXFORMAT3 vs the default of IDXFORMAT8 # #--------------------------------------------------------------------------- [XFH-DEFAULT] IDXNAMETYPE=2 IDXFORMAT=8 #--------------------------------------------------------------------------- #Note1 - 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' ext # and it does include the indexes (in spite of its name) #--------------------------------------------------------------------------- #Note2 - The above sets IDXFORMAT8 as the default for all varlth indexed files # (can specify individual files differently as shown by [INTERNAL...] # - You can also set IDXFORMATs within the COBOL source programs example: # # $SET IDXFORMAT(3) <-- use IDXFORMAT3 for varlth indexed files in this program # - $SET... could be on the 1st line & start in column 7 # - could specify between 'SELECT' stmnts to change from file to file #---------------------------------------------------------------------------
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
Note |
|
4a. cp /home/uvadm/dat1/idxtest dat1 ================================
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 ========================================
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 |
|
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
dat1/idxtest --------------> dat2/idxf8Icbl -------------> dat3/idxf8Luxcp cblidx81 uxcp
1a. export FILE1=dat1/idxtest <-- specify input file =========================
1b. export FILE2=dat2/idxf8Icbl <-- specify output file ==========================
1c. cobrun cblx/cblidx81 <-- execute COBOL program ====================
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) =============
3a. cat dat3/idxf8Luxcp ===================
0010.0060 idxtest text file to create Var Lth Indexed files 0020.0064 - input to COBOL & uxcp to create IDXFORMAT1,3,8 files 0030.0072 - 01-04=ISAM key, 05=.separator,06-09=recsize,10-400 text 0040.0076 - output record varies from 64 to 256 depending on recsize 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)
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
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) =========================
10 20 30 40 50 60 r# 1 0123456789012345678901234567890123456789012345678901234567890123 0 3.......0508281547526105082815475261.>.......................2.. 3F00000033333333333333333333333333330300000000000000000009000300 3E00000005082815475261050828154752610E02001800001060000010000200 64 ............................................X"8*X"8*............ 000000000000000000000000000000000000000000005232523200000000001B 00000007000022100000000000000000000000000008828A828A000000000000 128 ................................................................ 0000001B000000000000000000000000000000000000000F0000000000000000 000000004244010400000040000000C0000000000000003E0000000000000000 - - - remainder of header deleted (all x'00's to 1024) - - -
10 20 30 40 50 60 r# 2 0123456789012345678901234567890123456789012345678901234567890123 3480 @<0010.0060 idxtest test file to create ISAM Variable length .. 4333332333326673522276772666627626766762454425676666626666762200 0C0010E00600948830D04534069C504F03251450931D0612912C50C5E7480000 10 20 30 40 50 60 r# 3 0123456789012345678901234567890123456789012345678901234567890123 3544 @80020.0056 - input to 'cblidx81.cbl' & 'uxcp' ...... 4333332333322222222266777276226666673326662222277672222222000000 080020E00560000000D09E05404F073F294881E3F27060758307000000000000 10 20 30 40 50 60 r# 4 0123456789012345678901234567890123456789012345678901234567890123 3608 @H0030.0072 01-04=ISAM key, 05=.separator,06-09=recsize,10-400 t 4433332333323323334544266722333276767676723323337667676233233327 080030E0072001D04D931D0B59C005DE3501214F2C06D09D25339A5C10D40004 64 ext ...... 6772222222000000 5840000000000000 10 20 30 40 50 60 r# 5 0123456789012345678901234567890123456789012345678901234567890123 3688 @L0040.0076 - output record varies from 64 to 256 depending on r 4433332333322267777727666762767667267662332762333266766666626627 0C0040E00760D0F540540253F240612953062FD06404F025604505E49E70FE02 64 ecsize 06-09 .. 6676762332332200 5339A5006D090000 - - - 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
dat1/idxtest ------------> dat2/idxf8Iuxcp -----------------> dat3/idxf8Lcbl uxcp cblidx82
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) =============
2a. export FILE1=dat2/idxf8Iuxcp <-- specify input file ============================
2b. export FILE2=dat3/idxf8Lcbl <-- specify output file ===========================
2c. cobrun cblx/cblidx82 <-- execute COBOL program ====================
3a. cat dat3/idxf8Lcbl ==================
0010.0060 idxtest text file to create Var Lth Indexed files 0020.0064 - input to COBOL & uxcp to create IDXFORMAT1,3,8 files 0030.0072 - 01-04=ISAM key, 05=.separator,06-09=recsize,10-400 text 0040.0076 - output record varies from 64 to 256 depending on recsize 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)
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
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/idxf8Iuxcp.dat v <-- display IDXf8 file (created by uxcp) ==========================
uvhd filename=/home/uxcbltest/dat2/idxf8Iuxcp options=x lastmod=2005082815 today=200508281559 iprint=i99 rec#=1 rcount=68 filesize=4120 recsize=1024 fsize%rsize(remainder)=0 10 20 30 40 50 60 r# 1 0123456789012345678901234567890123456789012345678901234567890123 0 3.......0508281556350405082815563504.>.......................<.. 3F00000033333333333333333333333333330300000000000000000000000300 3E00000005082815563504050828155635040E02001800001060000010000C00 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 test file to create ISAM Variable length .. 4333332333326673522276772666627626766762454425676666626666762200 0C0010E00600948830D04534069C504F03251450931D0612912C50C5E7480000 10 20 30 40 50 60 r# 3 0123456789012345678901234567890123456789012345678901234567890123 3400 @<0020.0056 - input to 'cblidx81.cbl' & 'uxcp' .. 4333332333322222222266777276226666673326662222277672222222222200 0C0020E00560000000D09E05404F073F294881E3F27060758307000000000000 10 20 30 40 50 60 r# 4 0123456789012345678901234567890123456789012345678901234567890123 3464 @A0030.0072 01-04=ISAM key, 05=.separator,06-09=recsize,10-400 t 4433332333323323334544266722333276767676723323337667676233233327 010030E0072001D04D931D0B59C005DE3501214F2C06D09D25339A5C10D40004 64 ext..... 67700000 58400000 10 20 30 40 50 60 r# 5 0123456789012345678901234567890123456789012345678901234567890123 3536 @J0040.0076 - output record varies from 64 to 256 depending on r 4433332333322267777727666762767667267662332762333266766666626627 0A0040E00760D0F540540253F240612953062FD06404F025604505E49E70FE02 64 ecsize 06-09.... 6676762332330000 5339A5006D090000 - - - 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
Note |
|
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
# 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/vsetest for testlibs export RUNDATA=$HOME/testdata # <-- apps superdir of data subdirs # above RUNLIBS & RUNDATA used for JCL conversion test/demo # production should use separate filesystems for RUNLIBS & RUNDATA for example: # export RUNLIBS=/p2/prodlibs/apay <-- sample Acts PAYable system # export RUNDATA=/p2/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
& 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
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'.
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' --->
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
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:\vsetest\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:\\vsetest\\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).
For UWIN the COBCPY export would be:
export COBCPY=D:\\users\\vsetest\\cpys <-- does not work for UWIN ======================================
echo $COBCPY --> D:\users\vsetest\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/vsetest/cpys) <-- for UWIN ==============================================
export COBCPY=$(cygpath -w /h/vsetest/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
#!/bin/ksh # mfnxcbl1 - compile Micro Focus Net Express on Windows under SFU/UWIN/CYGWIN # - see Vancouver Utility doc VSECOBOL.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 the profile # export COBCPY=H:\\vsetest\\cpys <-- works for SFU & CYGWIN, not UWIN # =============================== # export COBCPY=$(winpath /d/users/vsetest/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
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 'vsetest' setup on SFU as per WindowsSFU.htm. #2b. Account 'vsetest' setup on UWIN as per CygwinUwin.htm. #2c. Account 'vsetest' setup on CYGWIN as per CygwinUwin.htm. 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/jclunixop5), which generates COBOL program executions as follows (using jar100 for example):
runw jar100 <-- runw executes .int (& .idy if animation switch on) ===========
#1a. Logon to Windows as vsetest & click on SFU ksh desktop ICON #1b. Or click on UWIN desktop ICON & login as vsetest #1c. Or click on CYGWIN/vsetest ICON on windows desktop --> SFU homedir D:\SFU\home\vsetest (or /home/vsetest) --> UWIN homedir D:\users\vsetest (or /d/users/vsetest) --> CYGWIN homedir H:\vsetest (or /h/vsetest) --> subdirs: cbls, cpys, cblx, jcls, testdata, tmp, etc --> COBOL & JCL: cbls/car100.cbl, jcls/jar100.ksh --> input datafile: testdata/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
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.
#1a. Logon to Windows as vsetest & click on SFU ksh desktop ICON #1b. Or click on UWIN desktop ICON & login as vsetest #1c. Or click on CYGWIN/vsetest ICON on windows desktop --> SFU homedir D:\SFU\home\vsetest (or /home/vsetest) --> UWIN homedir D:\users\vsetest (or /d/users/vsetest) --> CYGWIN homedir H:\vsetest (or /h/vsetest) --> subdirs: cbls, cpys, cblx, jcls, testdata, tmp, etc --> COBOL & JCL: cbls/car100.cbl, jcls/jar100.ksh --> input datafile: testdata/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 vsetest 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) ================= #$RLX/car100 - comment out original call to cobol program runw H:\\vsetest\\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
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 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