Open chookperson opened 1 year ago
V181 IMPLEMENTATION 6TH JANUARY 2023 JCLH ==================== ================ ====
This document represents my journey through testing my programs against the environment represented by the latest release of z390.
Since I changed some javas amongst az390, ez390, lz390, mz390, pz390, sz390, tz390. zc390, z390, I can't use the JAR in my testing, so everything will need adjusting to access my javas.
The new version of Z390, as appears in the download of v1.8.1, is different from that which I am used to.
The document was intended as an aide memoire for self, rather than to be understandable by a wider audience. So please forgive any errors, snafus and omissions.
v1.8.1 has a "source" download, which for instance would have CBL but wouldn't have been compiled, so it wouldn't have MLC, BAL, 390, ERR, PRN etc. files.
v1.8.1 has a "runtime" download, which at this point of time hasn't really been investigated, but I note that there isn't a directory for SRC, i.e. JAVA files don't appear in the "runtime".
I want eventually to "deliver" the consumables from my DB2 porting project to Z390 thru Abe and hopefully on to z390 proper, perhaps thru github, but I realise that my stuff doesn't match v181.
So I have downloaded "source" into c:\v181, whereas in the release I am familiar with, it was c:\z390.
I will make what changes are necessary to "v181", to allow the CB001 thru CB094 set of CBLs to be OK.
I note already that BAT files instead of being in the "root" directory, formerly Z390, are in v181\BAT directory.
So I have copied ZC390, ZC390C. ZC390CL and ZC390CL across from z390 "root" to v181\BAT where they have been renamed as ZC181, ZC181C, ZC181CL and ZC181CL.
And changed internally, so that instead of getting the "old" versions in z390.jar, they pick up the newly compiled versions of the necessary JAVAs, that were in the old JAR.
Also, I nearly forgot, I have copied the files that I deemed were necessary for the CBnnn's and the DB2's across to v181.
When first I tried to run ZC181 in v181 (cd c:\v181, bat\ZC181ZCOBOL\DEMO\CB001), I immediately struck my first problem, "unable to set" which emanated from the v181 version of TZ390.JAVA, which was looking for the "properties" file, which I discovered was something githubbian. To temporarily get around this problem, I did a change to it to comment out the "method of "getVersion" and replace it with "v1.8.1" and to recompile it.
That nasty message dissolved.
bat\zc181 zcobol\demo\cb001 seemed to work, no other errors were reported.
But don't get too excited, when I tried bat\zc181c, it spat the dummy, because the new directory structure had struc(k)-tured again. ZC390CLG.OPT couldn't be found in the ZCOBOL\Z390 directory, because the directory had been renamed as the ZCOBOL\OPT directory and the file itself was renamed from ZC390CLG.OPT to CBLOPT.OPT, that entailed changes to bat\ZC181C.BAT to point to the new option file (note to self, I'll need to make the same changes to ZC181CL and ZC181CLG).
I just remembered that MACs were in various places in the "old" version, now they have been centralized into v181\MAC, that will cause problems.
When bat\ZC181C was run again, lo and behold, o shi...... a number of problems,
1) GEN_PROC_END 2) ZC390LIB 3) ZCVT 4) PP2 5) The files for NNN_FILE DCB DSORG=PS,RECFM=FT,BLKSIZE=0, OUT_FILE DCB DSORG=PS,RECFM=FT,BLKSIZE=0, PUT_FILE DCB DSORG=PS,RECFM=FT,BLKSIZE=0, PPP_FILE DCB DSORG=PS,RECFM=FT,BLKSIZE=0, QQQ_FILE DCB DSORG=PS,RECFM=FT,BLKSIZE=0, OPE_FILE DCB DSORG=PS,RECFM=FT,BLKSIZE=0, FFF_FILE DCB DSORG=PS,RECFM=FT,BLKSIZE=0, LUP_FILE DCB DSORG=PS,RECFM=FT,BLKSIZE=0, PP2_FILE DCB DSORG=PS,RECFM=FT,BLKSIZE=0, 6) missing macro =SAVE missing macro =LOAD missing macro =WTO missing macro =ZOPEN missing macro =DCBD missing macro =DCB 7) 3 undefined symbols, presumably in the error 198's
Whatever they are about, I'm sure that I'm just about to find out.
c:\V181>rem ZC181C translate CBL to MLC and assemble using z390
c:\V181>echo off
01:55:56 cb001 ZC390 START USING z390 V1.8.1 ON J2SE 17.0.1 01/06/23
01:55:56 cb001 ZC390 ENDED RC= 0 SEC= 0 MEM(MB)= 9 IO=2
01:55:56 cb001 MZ390 START USING z390 V1.8.1 ON J2SE 17.0.1 01/06/23
MZ390E MNOTE 8,'GEN_PROC_END WS LENGTH ERROR = 949'
AZ390E error 29 (11/75)10 SAVE (14,12)
AZ390E error 29 (11/124)28 LOAD EP=ZC390LIB
AZ390E error 29 (11/127)31 WTO 'ZC390LIB NOT FOUND'
AZ390E error 29 (11/141)45 WTO 'ZC390LIB ZCVT VERIFY ERROR'
AZ390E error 198 (38/44)284 STH ZC_R0,PP2_FILE+DCBBLKSI-IHADCB
AZ390E error 198 (38/56)286 ST ZC_R0,PP2_FILE+DCBDSNAM-IHADCB
AZ390E error 198 (38/66)288 MVC DCBMACRF-IHADCB+PP2_FILE,0(ZC_R1)
AZ390E error 29 (38/73)289 ZOPEN (PP2_FILE,(OUTPUT))
AZ390E error 98 (38/65)287 LARL ZC_R1,=AL2(DCBMACRF_PM)
AZ390E error 29 (45/385)408 DCBD , RPI 1048
AZ390E error 29 (45/387)409 NNN_FILE DCB DSORG=PS,RECFM=FT,BLKSIZE=0,
AZ390E error 29 (45/387)413 OUT_FILE DCB DSORG=PS,RECFM=FT,BLKSIZE=0,
AZ390E error 29 (45/387)415 PUT_FILE DCB DSORG=PS,RECFM=FT,BLKSIZE=0,
AZ390E error 29 (45/387)417 PPP_FILE DCB DSORG=PS,RECFM=FT,BLKSIZE=0,
AZ390E error 29 (45/387)419 QQQ_FILE DCB DSORG=PS,RECFM=FT,BLKSIZE=0,
AZ390E error 29 (45/387)421 OPE_FILE DCB DSORG=PS,RECFM=FT,BLKSIZE=0,
AZ390E error 29 (45/387)423 FFF_FILE DCB DSORG=PS,RECFM=FT,BLKSIZE=0,
AZ390E error 29 (45/387)425 LUP_FILE DCB DSORG=PS,RECFM=FT,BLKSIZE=0,
AZ390E error 29 (45/387)427 PP2_FILE DCB DSORG=PS,RECFM=FT,BLKSIZE=0,
AZ390E ERRSUM Critical Error Summary Option
AZ390E ERRSUM Fix and repeat until all nested errors resolved
AZ390E ERRSUM missing macro =SAVE
AZ390E ERRSUM missing macro =LOAD
AZ390E ERRSUM missing macro =WTO
AZ390E ERRSUM missing macro =ZOPEN
AZ390E ERRSUM missing macro =DCBD
AZ390E ERRSUM missing macro =DCB
AZ390E ERRSUM total missing copy files =0
AZ390E ERRSUM total missing macro files =6
AZ390E ERRSUM total undefined symbols =3
AZ390E ERRSUM total mz390 errors = 0
AZ390E ERRSUM total az390 errors = 19
01:55:57 cb001 MZ390 ENDED RC=12 SEC= 0 MEM(MB)=117 IO=26617
Press any key to continue . . .
Let's have a look at v181/src for any JAVAs I haven't compiled. I seem to have compiled them all yesterday.
They have been compared with the desktop new source and a winmerge report has been generated for each of them, proving that any changes that I made were to the desktop versions not to the old z390 versions. Thus the classes in v181/src are correct.
MZ390E MNOTE 8,'GEN_PROC_END WS LENGTH ERROR = 949' occurs where WS is bigger than expected?
IDENTIFICATION DIVISION.
PROGRAM-ID. CB001.
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT NNN-FILE
ASSIGN TO 'ZCOBOL\DEMO\M6D.NNN'
ORGANIZATION IS LINE SEQUENTIAL.
SELECT OUT-FILE
ASSIGN TO 'ZCOBOL\DEMO\M3.OUT'
ORGANIZATION IS LINE SEQUENTIAL.
SELECT PUT-FILE
ASSIGN TO 'ZCOBOL\DEMO\NAVIG8OR.PUT'
ORGANIZATION IS LINE SEQUENTIAL.
SELECT PPP-FILE
ASSIGN TO 'ZCOBOL\DEMO\M2.PPP'
ORGANIZATION IS LINE SEQUENTIAL.
SELECT QQQ-FILE
ASSIGN TO 'ZCOBOL\DEMO\NAVIG8OR.QQQ'
ORGANIZATION IS LINE SEQUENTIAL.
SELECT OPE-FILE
ASSIGN TO 'ZCOBOL\DEMO\M7.OPE'
ORGANIZATION IS LINE SEQUENTIAL.
SELECT FFF-FILE
ASSIGN TO 'ZCOBOL\DEMO\NAVIG8OR.FFF'
ORGANIZATION IS LINE SEQUENTIAL.
SELECT LUP-FILE
ASSIGN TO 'ZCOBOL\DEMO\M7.LUP'
ORGANIZATION IS LINE SEQUENTIAL.
SELECT PP2-FILE
ASSIGN TO 'ZCOBOL\DEMO\M2.PP2'
ORGANIZATION IS LINE SEQUENTIAL.
DATA DIVISION.
FILE SECTION.
FD NNN-FILE
DATA RECORD IS NNN-RECORD.
01 NNN-RECORD PIC X(119).
FD OUT-FILE
DATA RECORD IS OUT-RECORD.
01 OUT-RECORD PIC X(256).
FD PUT-FILE
DATA RECORD IS PUT-RECORD.
01 PUT-RECORD PIC X(256).
FD PPP-FILE
DATA RECORD IS PPP-RECORD.
01 PPP-RECORD PIC X(110).
FD QQQ-FILE
DATA RECORD IS QQQ-RECORD.
01 QQQ-RECORD PIC X(110).
FD OPE-FILE
DATA RECORD IS OPE-RECORD.
01 OPE-RECORD PIC X(15).
FD FFF-FILE
DATA RECORD IS FFF-RECORD.
01 FFF-RECORD PIC X(1968).
FD LUP-FILE
DATA RECORD IS LUP-RECORD.
01 LUP-RECORD PIC X(241).
FD PP2-FILE
DATA RECORD IS PP2-RECORD.
01 PP2-RECORD PIC X(20001).
WORKING-STORAGE SECTION.
LINKAGE SECTION.
PROCEDURE DIVISION.
MAINLINE.
OPEN OUTPUT PP2-FILE.
STOP RUN.
The first thing to note is that it doesn't have a Working Storage area, so the GEN_PROC_END mnote isn't correct.
Look at it in 'old' version. Looks like the same code. The combined size of the files is 23,076 bytes. There could be additional overhead per file. But I don't know how to proceed with this one. I hope things become clearer as we proceed.
ZC390LIB.MLC is in c:\z390\z390
ZC390LIB.MLC is in c:\z390\zcobol\z390
ZC390LIB.MLC is in c:\v181\zcobol\lib
So it seems that ZC390LIB.MLC is in a different directory in V181. AZ390E error 29 (11/127)31 WTO 'ZC390LIB NOT FOUND'
look for error msg in AZ390.JAVA
I can't find the msg anywhere in the v181 JAVAs.
Found it c:\V181\zcobol\mac\GEN_ID.MAC: WTO 'ZC390LIB NOT FOUND'
also FINDSTR found c:\V181\bash\bldcbllib:# bldcbllib: rebuild zcobol/lib/ZC390LIB.390 c:\V181\bash\bldcbllib:bash/asml zcobol/lib/ZC390LIB $sysmac $syscpy $sys390 RMODE24 $1 $2 $3 $4 $5 $6 $7 $8 $9 c:\V181\bash\bldcbllib:echo "Verify ZC390LIB.390 build ok"
looks like we have to rerun the bash script to get the 390 file, which GEN_ID cannot find and therefore cannot load.
SAVE Z390\MAC LOAD Z390\MAC WTO Z390\MAC ZOPEN Z390\MAC DCBD Z390\MAC DCB Z390\MAC
SAVE V181\MAC LOAD V181\MAC WTO V181\MAC ZOPEN V181\MAC DCBD V181\MAC DCB V181\MAC
So on the surface they're the same. The "ERRSUM missing macro" emanates from AZ390.JAVA.
But in that area the z390 java and the v181 java look the same.
The checking is done in TZ390.JAVA. looked at AZ390.JAVA re ERRSUM but it's too complicated.
Maybe I ought to look at any logs in v181 to see what BAT/BASH scripts have been run supposing that the "runtime" was generated by same.
Cos I'm not using the runtime. I'm working from the "source", trying to fix problems as I go.
Or I could just try compiling CB002 et al and see what pops out. I tried compiling first dozen and they all had problems finding those MACs noted above.
I think that I might run BAT\BLDCBLLIB in v181, it might get rid of the Z390LIB.390 problem, at least.
run BAT\BLDCBLLIB.BAT in V181 with log to bldcbllib.out fell over couldn't find or load main class mz390
Look at BAT
@if /I "%1" == "tron" (echo on) else (echo off) rem rebuild zcobol\z390\zc390lib.390
setlocal if /I "%1" == "tron" (set z_TraceMode=tron shift /1 ) else (if /I "%1" == "troff" (set z_TraceMode=troff shift /1 ) else (set z_TraceMode=) ) set /A z_NestLevel=%z_NestLevel%+1 rem ----- Lvl(%z_NestLevel%) Start %0 %1 %2 %3 %4 %5 %6 %7 %8 %9
pushd %~dps0.. call bat\asm %z_TraceMode% zcobol\lib\ABORT sysmac(mac) syscpy(mac+zcobol\lib) %1 %2 %3 %4 %5 %6 %7 %8 %9 || goto error call bat\asm %z_TraceMode% zcobol\lib\ACCEPT sysmac(mac) syscpy(mac+zcobol\lib) %1 %2 %3 %4 %5 %6 %7 %8 %9 || goto error call bat\asm %z_TraceMode% zcobol\lib\CVTTOHEX sysmac(mac) syscpy(mac+zcobol\lib) %1 %2 %3 %4 %5 %6 %7 %8 %9 || goto error call bat\asm %z_TraceMode% zcobol\lib\DISPLAY sysmac(mac) syscpy(mac+zcobol\lib) %1 %2 %3 %4 %5 %6 %7 %8 %9 || goto error call bat\asm %z_TraceMode% zcobol\lib\INSPECT sysmac(mac) syscpy(mac+zcobol\lib) %1 %2 %3 %4 %5 %6 %7 %8 %9 || goto error call bat\asm %z_TraceMode% zcobol\lib\ZC390NUC sysmac(mac) syscpy(mac+zcobol\lib) %1 %2 %3 %4 %5 %6 %7 %8 %9 || goto error call bat\asml %z_TraceMode% zcobol\lib\ZC390LIB sysmac(mac) syscpy(mac+zcobol\lib) sys390(zcobol\lib) rmode24 %1 %2 %3 %4 %5 %6 %7 %8 %9 || goto error if not exist zcobol\lib\ZC390LIB.390 (set z_ReturnCode=12 echo %0 ERROR: ZC390LIB.390 was not created goto return) set z_ReturnCode=0 goto return
:error set z_ReturnCode=%ERRORLEVEL% echo %0 ERROR: Encountered RC %z_ReturnCode% - exiting :return popd rem ----- Lvl(%z_NestLevel%) End %0 %1 %2 %3 %4 %5 %6 %7 %8 %9 exit /b %z_ReturnCode%
ABORT, ACCEPT, CVTTOHEX, DISPLAY, INSPECT, ZC390NUC and ZC390LIB are all in v181\zcobol\lib where they are all MLCs
It uses BAT\ASM to run the JAVA
@if /I "%1" == "tron" (echo on) else (echo off) rem asm run macro assembly to generate relocatable obj from mlc source
setlocal if /I "%1" == "tron" (set z_TraceMode=tron shift /1 ) else (if /I "%1" == "troff" (set z_TraceMode=troff shift /1 ) else (set z_TraceMode=) ) set /A z_NestLevel=%z_NestLevel%+1 rem ----- Lvl(%z_NestLevel%) Start %0 %1 %2 %3 %4 %5 %6 %7 %8 %9
if /I %1. == . (set /P z_file=Hit Enter for help or suppply name of mlc file to assemble: ) else (set z_file=%1) if /I %z_file%. == . goto help :chkfile rem convert Unix path notation to Windows before checking the file set z_file=%z_file:/=\% if exist %z_file%.MLC goto file_ok rem if user specified valid extension, strip it off if /I %z_file:~-4%. NEQ .MLC. goto help set z_file=%z_file:~0,-4% if exist %z_file%.MLC goto file_ok echo %0 ERROR: %z_file%.MLC was not found set z_ReturnCode=16 goto return
:file_ok if exist %z_file%.BAL erase %z_file%.BAL if exist %z_file%.PRN erase %z_file%.PRN if exist %z_file%.OBJ erase %z_file%.OBJ if exist %z_file%.LST erase %z_file%.LST if exist %z_file%.390 erase %z_file%.390 if exist %z_file%.LOG erase %z_file%.LOG if exist %z_file%.ERR erase %z_file%.ERR if exist %z_file%.STA erase %z_file%.STA if exist %z_file%.TR erase %z_file%.TR
rem get the z390 directory set "z_HomeDir=%~dps0..\" for %%f in ("%z_HomeDir%") do set "z_HomeDir=%%~ff"
call %~dps0mz390 %z_TraceMode% %z_file% sysmac(+%z_HomeDir%mac) syscpy(+%z_HomeDir%mac) %2 %3 %4 %5 %6 %7 %8 %9 set z_ReturnCode=%ERRORLEVEL% rem any error or warning message has been issued by mz390 if %z_ReturnCode% NEQ 0 (if %z_ReturnCode% NEQ 4 (if exist %z_file%.OBJ (erase %z_file%.OBJ) goto return))
:return rem ----- Lvl(%z_NestLevel%) End %0 %1 %2 %3 %4 %5 %6 %7 %8 %9 exit /b %z_ReturnCode%
:help echo . echo the ASM.BAT procedure is intended to assemble a single assembler program echo . set /P z_file=Hit Enter for more help or suppply name of mlc file to assemble: if /I %z_file%. NEQ . goto chkfile
call %~dps0help %z_TraceMode% set z_ReturnCode=16 goto return
BAT/ASM.BAT invokes JAVA via "call %~dps0mz390" notepad++'ed it and added "echo %0 path to mz390 %~dps0"
reran BAT/BLDCBLLIB.BAT
It gave
bat\asm path to mz390 c:\V181\bat\ and MZ390.JAVA/CLASS aint in that location
google says that a call in a DOS BATch file is to call another DOS BATch file, so I can expect there to be a BAT\MZ390.BAT as well
@if /I "%1" == "tron" (echo on) else (echo off) rem execute mz390 runtime with java runtime options:
setlocal if /I "%1" == "tron" (set z_TraceMode=tron shift /1 ) else (if /I "%1" == "troff" (set z_TraceMode=troff shift /1 ) else (set z_TraceMode=) ) set /A z_NestLevel=%z_NestLevel%+1 rem ----- Lvl(%z_NestLevel%) Start %0 %1 %2 %3 %4 %5 %6 %7 %8 %9
if /I %1. == . (echo %0 ERROR: missing file name set z_ReturnCode=16 goto return )
rem 01/15/09 DSH added 150 MB init and max mem for zcobol rem -classpath path to jar file rem -verbose:gc trace garbage collection to detect memory leaks rem -XmsnK set initial memory allocation to nK rem -XmxnK set max memory allocation to nK rem -Xrs allow control break interruption of java tasks java -classpath %~dps0..\z390.jar -Xrs -Xms150000K -Xmx150000K %J2SEOPTIONS% mz390 %1 %2 %3 %4 %5 %6 %7 %8 %9
set z_ReturnCode=%ERRORLEVEL% if %z_ReturnCode% EQU 0 goto return if %z_ReturnCode% EQU 4 (echo %0 WARNING: See warnings on mz390 generated bal file and console goto return ) rem ErrorLevel 1 for Java issues or ErrorLevel 8 / 12 for assembly issues echo %0 ERROR: See errors on mz390 generated bal file and console
:return rem ----- Lvl(%z_NestLevel%) End %0 %1 %2 %3 %4 %5 %6 %7 %8 %9 exit /b %z_ReturnCode%
notepad++'ed BAT\MZ390.BAT to include "rem jclh /n echo %0 path to mz390 %~dps0" to it
and reran BAT\BLDCBLLIB.BAT It gave c:\V181\bat\mz390 path to mz390 c:\V181\bat\ where z390.jar is supposed to reside
Used File Explorer to look for z390.jar in v181, didn't find it. I suppose one will not find a "runtime" object in a "source" environment.
I'll have to make further changes to "source" BAT files that invoke JAVA/CLASS to point to v181/src rather than v181/bat
change BAT\MZ390.BAT to point to v181\src
REM JCLH rem java -classpath %~dps0..\z390.jar -Xrs -Xms150000K -Xmx150000K %J2SEOPTIONS% mz390 %1 %2 %3 %4 %5 %6 %7 %8 %9 echo jclh changed classpath in %0 to v181\src java -classpath v181\src\mz390 -Xrs -Xms150000K -Xmx150000K %J2SEOPTIONS% mz390 %1 %2 %3 %4 %5 %6 %7 %8 %9
create BAT/JHJAV.BAT which just runs the java class change BAT/MZ390.BAT to use it
OK let's review where we are We wanted to run BAT\BLDCBLLIB.BAT which calls ASM.BAT which calls MZ390.BAT under V181.
I got errors with BLDCBLLIB which occasioned looking at ASM which in turn led to MZ390.
I have had a lot of trouble getting JAVAC and JAVA to recognise MZ390(.CLASS), perhaps this is ongoing.
I saw above a mention of BLDCBLLIB with regard to a BASH version of BLDCBLLIB where it also mentioned the parameters to be passed.
So I need to review in v181 - BAT(or BASH)\BLDCBLLIB, BAT\ASM.BAT, BAT\MZ390.BAT to ensure that they are compatible with v181, the path, the classpath, the new directory structure, the whereabouts of the java bin files. ....
So lets go back to BLDCBLLIB
Z390 has both an MLC and a 390 file for ZC390LIB
BUT V181 only has an MLC file for ZC390LIB
AZ390E error 29 (11/127)31 WTO 'ZC390LIB NOT FOUND'
c:\V181\zcobol\mac\GEN_ID.MAC: WTO 'ZC390LIB NOT FOUND'
c:\V181\bash\bldcbllib:# bldcbllib: rebuild zcobol/lib/ZC390LIB.390 c:\V181\bash\bldcbllib:bash/asml zcobol/lib/ZC390LIB $sysmac $syscpy $sys390 RMODE24 $1 $2 $3 $4 $5 $6 $7 $8 $9 c:\V181\bash\bldcbllib:echo "Verify ZC390LIB.390 build ok"
looks like we have to rerun the bash script to get the 390 file, which GEN_ID cannot find and therefore cannot load.
Running (NUJAVCLG hacked to bits) against MZ390, it errors cos it wants and expects an MLC file, perhaps it wants V181\ZCOBOL\LIB\BLDCBLLIB.MLC, as above, cos BLDCBLLIB sounds like it is trying to Build a CBL LIBrary.
It looks like bldcbllib is calling asml not asm
But I guess I'll have to look at a lot of BATch files to see whether they need to be massaged, not just ASM and ASML.
Eventually ran MZ390 in Z390 OK, "MZ390 Z390\ZC390LIB"
REM JCLH REM set path="c:\program files\Java\jdk-17.0.1\bin" REM echo path=%path% REM echo classpath=%~p1 REM echo program= %~n1 java -classpath src -Xrs -Xms150000K -Xmx150000K %J2SEOPTIONS% mz390 %1 %2 %3 %4 %5 %6 %7 %8 %9
in V181\BAT\MZ390.BAT got TZ390E abort error 10 - systerm file open error java.lang.NullPointerException z390_abort_request ZC390LIB MZ390 TZ390E abort error 10 - systerm file open error java.lang.NullPointerException BAT\MZ390 ERROR: See errors on mz390 generated bal file and console
changed v181\src\tz390 with my z390 change // jclh abort_error(10,"systerm file open error " + systerm_file_name + e.toString()); which is the inclusion of the systerm_file_name in the error msg
jhjavc it, followed by jhjavc mz390 bat\jhjavc src\tz390 then bat\jhjavc src\mz390 ok then ok
I went thru the exercise of adding a lot of System.out.println's to TZ390, hours and hours, only to find that BAT\MZ390 LIB\ZC390LIB is wrong, it should be BAT\MZ390 ZCOBOL\LIB\ZC390LIB
Comment-out all JCLH lines in TZ390
Did that and BAT\JHJAVC SRC\TZ390 OK BAT\JHJAVC SRC\MZ390 OK BAT\MZ390 ZCOBOL\LIB\ZC390LIB OK
Hooray
Edited BAT\AZ390.BAT & BAT\EZ390.BAT to conform with "java" command in BAT\MZ390.BAT
Recapping
Run ZC181 on CB001 in V181, "UNABLE TO SET", githubbian, fixed with change to V181\SRC\TZ390.JAVA.
Run ZC181C on CB001 in V181, ZCOBOL\Z390\ZC390CLG.OPT becomes ZCOBOL\OPT\CBLOPT.OPT,
Changes needed to ZC181C and ZC181CLG.
When bat\ZC181C was run again, lo and behold, o shi......
a number of problems, 1) GEN_PROC_END 2) ZC390LIB 3) ZCVT 4) PP2 5) The files for NNN_FILE DCB DSORG=PS,RECFM=FT,BLKSIZE=0, OUT_FILE DCB DSORG=PS,RECFM=FT,BLKSIZE=0, PUT_FILE DCB DSORG=PS,RECFM=FT,BLKSIZE=0, PPP_FILE DCB DSORG=PS,RECFM=FT,BLKSIZE=0, QQQ_FILE DCB DSORG=PS,RECFM=FT,BLKSIZE=0, OPE_FILE DCB DSORG=PS,RECFM=FT,BLKSIZE=0, FFF_FILE DCB DSORG=PS,RECFM=FT,BLKSIZE=0, LUP_FILE DCB DSORG=PS,RECFM=FT,BLKSIZE=0, PP2_FILE DCB DSORG=PS,RECFM=FT,BLKSIZE=0, 6) missing macro =SAVE missing macro =LOAD missing macro =WTO missing macro =ZOPEN missing macro =DCBD missing macro =DCB 7) 3 undefined symbols, presumably in the error 198's
BLDCBLLIB creates ZC390LIB.390 from ZC390LIB.MLC
When first run, it fell over "couldn't find class mz390".
BLDCBLLIB.BAT calls ASM.BAT calls MZ390.BAT
Have to look at ASM.BAT, ASML.BAT, ASMLG.BAT
Finally BAT\MZ390 LIB\ZC390LIB wrong BAT\MZ390 ZCOBOL\LIB\ZC390LIB right
Look at ASM.BAT, ASML.BAT and ASMLG.BAT
ASM.BAT calls MZ390.BAT ASML.BAT calls MZ390.BAT and LZ390.BAT ASMLG.BAT calls MZ390.BAT, LZ390.BAT and EZ390.BAT
I haven't looked at LZ390.BAT yet, done.
And SRC\LZ390.JAVA hasn't been compiled yet? The class is there.
Run BAT\BLDCBLLIB again, LOOKS OK.
Let's run BAT\ZC181C ZCOBOL\DEMO\CB001 again. looks similar to last time.
Apart from the BLDCBLLIB, there's a BLDLIB, BLDJAR, BLDZSTRMAC.
Let's run these excluding BLDJAR.
BAT\BLDLIB ran to end without error. BAT\BLDZSTRMAC ran to end without error.
rerun BAT\ZC181C ZCOBOL\DEMO\CB001
unchanged
just found BAT\ZC390BLD.BAT, let's run that.
It's not set up to run in V181.
Calls all prefixed with BAT.
Rerun.
All Z390 changed to LIB.
Rerun. ran to end ok.
rerun BAT\ZC181C ZCOBOL\DEMO\CB001 unchanged.
I've found something else that's different, there's a whole bunch of BAT files in the ZPAR directory. I was looking for ZCCLG.BAT which I believed was the new zcobol compile bat and found it in zpar. I thought perhaps I needed to change something because some of the MACs are in V181\MAC whilst others are in V181\ZCOBOL\MAC and I thought that ZCCLG would reflect those changes.
Look at BAT\ZCCLG.BAT in the "runtime" environment which does reflect the differences with regard to the MACs.
call %~dps0ZC390 %z_TraceMode% %z_file% %2 %3 %4 %5 %6 %7 %8 %9
call %~dps0MZ390 %z_TraceMode% %z_file% @%z_HomeDir%zcobol\opt\CBLOPT sysmac(%z_HomeDir%zcobol\mac+mac) syscpy(+%z_HomeDir%zcobol\cpy) %2 %3 %4 %5 %6 %7 %8 %9
call %~dps0LZ390 %z_TraceMode% %z_file% %2 %3 %4 %5 %6 %7 %8 %9
call %~dps0EZ390 %z_TraceMode% %z_file% sys390(+%z_HomeDir%zcobol\lib) %2 %3 %4 %5 %6 %7 %8 %9
"%PF%Java\jdk-17.0.1\bin\java.exe" -Xrs zc390 %1 SYSCPY(+zcobol+zcobol\z390) %2 %3 %4 %5 %6 %7 %8 %9
"%PF%Java\jdk-17.0.1\bin\java.exe" -Xrs zc390 %1 SYSCPY(+zcobol+zcobol\z390) %2 %3 %4 %5 %6 %7 %8 %9
"%PF%Java\jdk-17.0.1\bin\java.exe" -Xrs mz390 %1 @zcobol\OPT\CBLOPT.OPT %2 %3 %4 %5 %6 %7 %8 %9
"%PF%Java\jdk-17.0.1\bin\java.exe" -Xrs zc390 %1 SYSCPY(+zcobol+zcobol\z390) %2 %3 %4 %5 %6 %7 %8 %9
"%PF%Java\jdk-17.0.1\bin\java.exe" -Xrs mz390 %1 @zcobol\z390\ZC390CLG %2 %3 %4 %5 %6 %7 %8 %9
"%PF%Java\jdk-17.0.1\bin\java.exe" -Xrs lz390 %1 SYSOBJ(+zcobol\z390) %2 %3 %4 %5 %6 %7 %8 %9
"%PF%Java\jdk-17.0.1\bin\java.exe" -Xrs zc390 %1 SYSCPY(+zcobol+zcobol\z390) %2 %3 %4 %5 %6 %7 %8 %9
"%PF%Java\jdk-17.0.1\bin\java.exe" -Xrs mz390 %1 @zcobol\z390\ZC390CLG %2 %3 %4 %5 %6 %7 %8 %9
"%PF%Java\jdk-17.0.1\bin\java.exe" -Xrs lz390 %1 SYSOBJ(+zcobol\z390) %2 %3 %4 %5 %6 %7 %8 %9
"%PF%Java\jdk-17.0.1\bin\java.exe" -Xrs ez390 %1 SYS390(+zcobol\z390) %2 %3 %4 %5 %6 %7 %8 %9
change
"%PF%Java\jdk-17.0.1\bin\java.exe" -Xrs zc390 %1 SYSCPY(+zcobol+zcobol\z390) %2 %3 %4 %5 %6 %7 %8 %9 unchanged
"%PF%Java\jdk-17.0.1\bin\java.exe" -Xrs mz390 %1 @zcobol\opt\CBLOPT sysmac(%zcobol\mac+mac) syscpy(%zcobol\cpy) %2 %3 %4 %5 %6 %7 %8 %9 changed
"%PF%Java\jdk-17.0.1\bin\java.exe" -Xrs lz390 %1 SYSOBJ(+zcobol\z390) %2 %3 %4 %5 %6 %7 %8 %9 unchanged
"%PF%Java\jdk-17.0.1\bin\java.exe" -Xrs ez390 %1 SYS390(+zcobol\lib) %2 %3 %4 %5 %6 %7 %8 %9 changed
relevant changes were made
now retry BAT\ZC181C ZCOBOL\DEMO\CB001 in V181 most of previous errors gone away, but now objecting to other MACs. Try removing % from sysmac and syscopy
now retry BAT\ZC181C ZCOBOL\DEMO\CB001 in V181 now just MZ390E error 101 (1/3)3 missing copy = CB001_ZC_LABELS.CPY MZ390E error 266 (1/3)3 missing copy = CB001_ZC_LABELS.CPY AZ390E error 144 (40/56)295 ST ZC_R0,PP2_FILE+DCBDSNAM- IHADCB
Try adding +zcobol to syscpy in BAT\ZC181C in V181
now retry BAT\ZC181C ZCOBOL\DEMO\CB001 in V181 the same errors
should have been +zcobol\demo, change & retry just AZ390E error 144 (41/56)294 ST ZC_R0,PP2_FILE+DCBDSNAM-IHADCB still remains
error144 (no base register) was occurring and resisted many attempts to fix it by moving the code around in the program. it was finally fixed by moving the FD for the file involved from the sixth position to the 4th position.
now retry BAT\ZC181C ZCOBOL\DEMO\CB001 in V181 all the errors have gone away
change BAT\ZC181CL and BAT\ZC181CLG,
remove % from sysmac and syscpy and add +zcobol\demo to syscpy
Try running the rest of my test programs Some have been omitted because they pulled the same problems as under z390 Only those that encountered new problems are shown
BAT\ZC181C ZCOBOL\DEMO\CB002 in V181
AZ390E error 42 (42/285)2148 BRAS ZC_R14,3 SET ZC_R1 TO A(INLINE LIT) AND SKIP OVER IT
/*
* symbol table global variables
*/
byte sym_sdt = 0; // dec, b'', c'', h''
byte sym_cst = 1; // CSECT )alias REL)
byte sym_dst = 2; // DSECT (alias REL)
byte sym_ent = 3; // ENTRY (alias REL)
byte sym_ext = 4; // EXTRN external link
byte sym_rel = 5; // RX (CST.DST,ENT)_
byte sym_rld = 6; // complex rld exp
byte sym_lct = 7; // loctr (changed to cst/dst).
byte sym_wxt = 8; // WXTRN weak external link RPI182
byte sym_und = 9; // undefined symbol RPI 694
001050 (1/456)1268 *ZC 139 SUBTRACT 1,FROM,DDUB1,GIVING,BUB1 001050 F20090B8D05C 0000B8 00B1FC (44/44)1269+ PACK ZCVT_PWORK2(1),0+DDUB1(1) PACK #1 NORMAL 001056 F00090B80040 0000B8 (41/1504)1270+ SRP ZCVT_PWORK2(1),64-0,0 00105C F800D0B090B8 00B250 0000B8 (41/1506)1271+ ZAP BUB1,ZCVT_PWORK2(1) 001062 (42/285)1272+ BRAS ZC_R14,3 SET ZC_R1 TO A(INLINE LIT) AND SKIP OVER IT AZ390E error 42 (42/285)1272 BRAS ZC_R14,3 SET ZC_R1 TO A(INLINE LIT) AND SKIP OVER IT AZ390I 2 invalid rel off bits 16 exp_type=0 sym_rel=5
symrel=5; // RX (CST.DST,ENT) whilst exp_type=0=sdt, that is a self-defining term
relevant working-storage lines in ZCOBOL\DEMO\CB002.CBL in V181
01 DDUB1 PIC 9(01) value 1.
01 BUB1 PIC 9(01) COMP-3 value 0.
neither field signed. IBM COBOL doesn't seem to demand they be signed. doesn't get error under "z390" environment
compared z390\zcobol\demo\cb002.prn with v181\zcobol\demo\cb002.prn at the point of error 42, the assembler is the same.
Looked at the JAVA in AZ390.JAVA, the error 42 appears in new code in V181
Only occurs on a SUBTRACT GIVING where the receiving field is COMP-3
bat\zc181c zcobol\demo\cb031 AZ390E error 193 (43/2074)251 MVI 0(6,ZC_R3),C'0' AZ390I unexpected character before close ), There’s an error in az390 in the expectation of one addressing structure When another is being received,
expecting “( something )” getting “(6,”
')' in get_hex_lbddd and get_exp_abs_bddd and get_exp_abs_v2xbddd and get_exp_abs_xbddd
the 193 is in get_exp_abs_bddd
I suspect that get_exp_abs_xbddd may have the correct shape (the xbddd shape) to fit 0(6,zc_r3) Though I’m a complete novice in these areas
bat\zc181c zcobol\demo\cb037 MZ390E MNOTE 8,'GEN_PROC_END WS LENGTH ERROR= 4'
It was an error in GEN_PROC_END.MAC
AZ390E error 17 (44/213)424 BRUCE5 DC AL2(1234+) RPI 1065 when zcobol DISPLAYs a single COMP variable, either explicit positive sign or negative sign
bat\zc181c zcobol\demo\cb046 AZ390E error 98 (36/75)262 IILF ZC_R7,WSADDR9-WS characters ZC missing from beginning of WS in GEN_BASE.MAC
bat\zc181c zcobol\demo\cb063 AZ390E error 98 (42/75)612 IILF ZC_R7,RETURN_CODE-WS see above
bat\zc181c zcobol\demo\cb068 MZ390E MNOTE 8,'ZC_CALC MISSING VAR STACK PTR' I suspect that the error occurs with unary signs (+ or -) in a COMPUTE.
bat\zc181c zcobol\demo\cb070 MZ390E MNOTE 8,'ZC_CALC MISSING VAR STACK PTR' see above
bat\zc181c zcobol\demo\cb079 MZ390E MNOTE 8,'ZC_CALC MISSING VAR STACK PTR' see above
That completes the testing of my CBnnn.CBL test programs.
STARTING TESTING OF DB2 PORTING PROJECT
Ran DB2PREPY under v181 crash
You have to run BAT\DB2PREPY TESTALL2
The GEN_PROC_END problem that occurred in z390
Doesn’t occur in z181, so had to remove my fix from v181.
Re-ran BAT\DB2PREPY TESTALL2 in v181, the GEN_PROC_END problem Has gone away, but now objects about zc181c on testall2, need to change DB2PREPY.BAT again to prefix ZC181C with BAT.
Reran BAT\DB2PREPY TESTALL2 SQLCA.CPY is missing, so copy if into v181\zcobol\demo from z390\zcobol\demo But it’s called SQLCA.CPZ. Copied OK.
Reran BAT\DB2PREPY TESTALL2 Ran OK.
Now on to DB2PREPZ, so lets have a look at it. Added BAT\ as prefix and changed ZC390J toZC181CLG
Ran BAT\DB2PREPZ missing target program name, so BAT\DB2PREPZ TESTALL2 had to change CD C:\Z390 to CD C:\V181 BAT\DB2PREPZ TESTALL2,JH,TES2,CHOOKY
DB2PREPZ massaged, RUTE=C:\V181
The DB2PREPZ.CBL itself needs massage in respect of the generated CMD lines BAT\ prefix added twice and compiled OK.
Now we have to massage BAT\DB2CRE8.BAT , RUTE plus ZC181CLG
It ran to the end and I couldn’t see any errors, look at the generated CBLs
And they all look OK.
Now NUATEST.BAT massage it.
SQUELCH5 calls WREAD1 which uses SQL.BAT, it expects it to be under C:\Z390 but it’s getting written under C:\V181 – change BAT\NUATEST.BAT.
DB2PREPY TESTALL2 OK DB2PREPZ TESTALL2,JH,TES2,CHOOKY OK NUATEST TESTALL2,CHOOKY OK
DB2PREPY TESTALL3 OK DB2PREPZ TESTALL3,JH,TES2,CHOOKY OK NUATEST TESTALL3,CHOOKY OK
DB2PREPY TESTALL4 OK DB2PREPZ TESTALL4,JH,TES4,CHOOKY OK It generates 18 new CBLs NUATEST TESTALL4,CHOOKY S80A can’t cope
DB2PREPY TESTALL5 OK DB2PREPZ TESTALL5,JH,TES5,CHOOKY OK NUATEST TESTALL5,CHOOKY OK
DB2PREPY TESTALL6 OK DB2PREPZ TESTALL6,JH,TES6,CHOOKY OK NUATEST TESTALL6,CHOOKY Doesn’t like a SENSITIVE STATIC SCROLL CURSOR Same in z390
DB2PREPY TESTALL7 OK DB2PREPZ TESTALL7,JH,TES5,CHOOKY OK NUATEST TESTALL7,CHOOKY OK
DB2PREPY TESTALL8 OK DB2PREPZ TESTALL8,JH,TES8,CHOOKY OK NUATEST TESTALL8,CHOOKY OK
DB2PREPY TESTALL9 OK DB2PREPZ TESTALL9,JH,TES9,CHOOKY cannot cope with SQL command Same in z390 (an SQL WITH)
V181 IMPLEMENTATION 6TH JANUARY 2023 JCLH ==================== ================ ====
This document represents my journey through testing my programs against the environment represented by the latest release of z390.
Since I changed some javas amongst az390, ez390, lz390, mz390, pz390, sz390, tz390. zc390, z390, I can't use the JAR in my testing, so everything will need adjusting to access my javas.
The new version of Z390, as appears in the download of v1.8.1, is different from that which I am used to.
The document was intended as an aide memoire for self, rather than to be understandable by a wider audience. So please forgive any errors, snafus and omissions.
v1.8.1 has a "source" download, which for instance would have CBL but wouldn't have been compiled, so it wouldn't have MLC, BAL, 390, ERR, PRN etc. files.
v1.8.1 has a "runtime" download, which at this point of time hasn't really been investigated, but I note that there isn't a directory for SRC, i.e. JAVA files don't appear in the "runtime".
I want eventually to "deliver" the consumables from my DB2 porting project to Z390 thru Abe and hopefully on to z390 proper, perhaps thru github, but I realise that my stuff doesn't match v181.
So I have downloaded "source" into c:\v181, whereas in the release I am familiar with, it was c:\z390.
I will make what changes are necessary to "v181", to allow the CB001 thru CB094 set of CBLs to be OK.
I note already that BAT files instead of being in the "root" directory, formerly Z390, are in v181\BAT directory.
So I have copied ZC390, ZC390C. ZC390CL and ZC390CL across from z390 "root" to v181\BAT where they have been renamed as ZC181, ZC181C, ZC181CL and ZC181CL.
And changed internally, so that instead of getting the "old" versions in z390.jar, they pick up the newly compiled versions of the necessary JAVAs, that were in the old JAR.
Also, I nearly forgot, I have copied the files that I deemed were necessary for the CBnnn's and the DB2's across to v181.
When first I tried to run ZC181 in v181 (cd c:\v181, bat\ZC181ZCOBOL\DEMO\CB001), I immediately struck my first problem, "unable to set" which emanated from the v181 version of TZ390.JAVA, which was looking for the "properties" file, which I discovered was something githubbian. To temporarily get around this problem, I did a change to it to comment out the "method of "getVersion" and replace it with "v1.8.1" and to recompile it.
That nasty message dissolved.
bat\zc181 zcobol\demo\cb001 seemed to work, no other errors were reported.
But don't get too excited, when I tried bat\zc181c, it spat the dummy, because the new directory structure had struc(k)-tured again. ZC390CLG.OPT couldn't be found in the ZCOBOL\Z390 directory, because the directory had been renamed as the ZCOBOL\OPT directory and the file itself was renamed from ZC390CLG.OPT to CBLOPT.OPT, that entailed changes to bat\ZC181C.BAT to point to the new option file (note to self, I'll need to make the same changes to ZC181CL and ZC181CLG).
I just remembered that MACs were in various places in the "old" version, now they have been centralized into v181\MAC, that will cause problems.
When bat\ZC181C was run again, lo and behold, o shi...... a number of problems,
1) GEN_PROC_END 2) ZC390LIB 3) ZCVT 4) PP2 5) The files for NNN_FILE DCB DSORG=PS,RECFM=FT,BLKSIZE=0, OUT_FILE DCB DSORG=PS,RECFM=FT,BLKSIZE=0, PUT_FILE DCB DSORG=PS,RECFM=FT,BLKSIZE=0, PPP_FILE DCB DSORG=PS,RECFM=FT,BLKSIZE=0, QQQ_FILE DCB DSORG=PS,RECFM=FT,BLKSIZE=0, OPE_FILE DCB DSORG=PS,RECFM=FT,BLKSIZE=0, FFF_FILE DCB DSORG=PS,RECFM=FT,BLKSIZE=0, LUP_FILE DCB DSORG=PS,RECFM=FT,BLKSIZE=0, PP2_FILE DCB DSORG=PS,RECFM=FT,BLKSIZE=0, 6) missing macro =SAVE missing macro =LOAD missing macro =WTO missing macro =ZOPEN missing macro =DCBD missing macro =DCB 7) 3 undefined symbols, presumably in the error 198's
Whatever they are about, I'm sure that I'm just about to find out.
c:\V181>rem ZC181C translate CBL to MLC and assemble using z390
c:\V181>echo off
01:55:56 cb001 ZC390 START USING z390 V1.8.1 ON J2SE 17.0.1 01/06/23
01:55:56 cb001 ZC390 ENDED RC= 0 SEC= 0 MEM(MB)= 9 IO=2
01:55:56 cb001 MZ390 START USING z390 V1.8.1 ON J2SE 17.0.1 01/06/23
MZ390E MNOTE 8,'GEN_PROC_END WS LENGTH ERROR = 949'
AZ390E error 29 (11/75)10 SAVE (14,12)
AZ390E error 29 (11/124)28 LOAD EP=ZC390LIB
AZ390E error 29 (11/127)31 WTO 'ZC390LIB NOT FOUND'
AZ390E error 29 (11/141)45 WTO 'ZC390LIB ZCVT VERIFY ERROR'
AZ390E error 198 (38/44)284 STH ZC_R0,PP2_FILE+DCBBLKSI-IHADCB
AZ390E error 198 (38/56)286 ST ZC_R0,PP2_FILE+DCBDSNAM-IHADCB
AZ390E error 198 (38/66)288 MVC DCBMACRF-IHADCB+PP2_FILE,0(ZC_R1)
AZ390E error 29 (38/73)289 ZOPEN (PP2_FILE,(OUTPUT))
AZ390E error 98 (38/65)287 LARL ZC_R1,=AL2(DCBMACRF_PM)
AZ390E error 29 (45/385)408 DCBD , RPI 1048
AZ390E error 29 (45/387)409 NNN_FILE DCB DSORG=PS,RECFM=FT,BLKSIZE=0,
AZ390E error 29 (45/387)413 OUT_FILE DCB DSORG=PS,RECFM=FT,BLKSIZE=0,
AZ390E error 29 (45/387)415 PUT_FILE DCB DSORG=PS,RECFM=FT,BLKSIZE=0,
AZ390E error 29 (45/387)417 PPP_FILE DCB DSORG=PS,RECFM=FT,BLKSIZE=0,
AZ390E error 29 (45/387)419 QQQ_FILE DCB DSORG=PS,RECFM=FT,BLKSIZE=0,
AZ390E error 29 (45/387)421 OPE_FILE DCB DSORG=PS,RECFM=FT,BLKSIZE=0,
AZ390E error 29 (45/387)423 FFF_FILE DCB DSORG=PS,RECFM=FT,BLKSIZE=0,
AZ390E error 29 (45/387)425 LUP_FILE DCB DSORG=PS,RECFM=FT,BLKSIZE=0,
AZ390E error 29 (45/387)427 PP2_FILE DCB DSORG=PS,RECFM=FT,BLKSIZE=0,
AZ390E ERRSUM Critical Error Summary Option
AZ390E ERRSUM Fix and repeat until all nested errors resolved
AZ390E ERRSUM missing macro =SAVE
AZ390E ERRSUM missing macro =LOAD
AZ390E ERRSUM missing macro =WTO
AZ390E ERRSUM missing macro =ZOPEN
AZ390E ERRSUM missing macro =DCBD
AZ390E ERRSUM missing macro =DCB
AZ390E ERRSUM total missing copy files =0
AZ390E ERRSUM total missing macro files =6
AZ390E ERRSUM total undefined symbols =3
AZ390E ERRSUM total mz390 errors = 0
AZ390E ERRSUM total az390 errors = 19
01:55:57 cb001 MZ390 ENDED RC=12 SEC= 0 MEM(MB)=117 IO=26617
Press any key to continue . . .
Let's have a look at v181/src for any JAVAs I haven't compiled. I seem to have compiled them all yesterday.
They have been compared with the desktop new source and a winmerge report has been generated for each of them, proving that any changes that I made were to the desktop versions not to the old z390 versions. Thus the classes in v181/src are correct.
MZ390E MNOTE 8,'GEN_PROC_END WS LENGTH ERROR = 949' occurs where WS is bigger than expected?
IDENTIFICATION DIVISION.
PROGRAM-ID. CB001.
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT NNN-FILE
ASSIGN TO 'ZCOBOL\DEMO\M6D.NNN'
ORGANIZATION IS LINE SEQUENTIAL.
SELECT OUT-FILE
ASSIGN TO 'ZCOBOL\DEMO\M3.OUT'
ORGANIZATION IS LINE SEQUENTIAL.
SELECT PUT-FILE
ASSIGN TO 'ZCOBOL\DEMO\NAVIG8OR.PUT'
ORGANIZATION IS LINE SEQUENTIAL.
SELECT PPP-FILE
ASSIGN TO 'ZCOBOL\DEMO\M2.PPP'
ORGANIZATION IS LINE SEQUENTIAL.
SELECT QQQ-FILE
ASSIGN TO 'ZCOBOL\DEMO\NAVIG8OR.QQQ'
ORGANIZATION IS LINE SEQUENTIAL.
SELECT OPE-FILE
ASSIGN TO 'ZCOBOL\DEMO\M7.OPE'
ORGANIZATION IS LINE SEQUENTIAL.
SELECT FFF-FILE
ASSIGN TO 'ZCOBOL\DEMO\NAVIG8OR.FFF'
ORGANIZATION IS LINE SEQUENTIAL.
SELECT LUP-FILE
ASSIGN TO 'ZCOBOL\DEMO\M7.LUP'
ORGANIZATION IS LINE SEQUENTIAL.
SELECT PP2-FILE
ASSIGN TO 'ZCOBOL\DEMO\M2.PP2'
ORGANIZATION IS LINE SEQUENTIAL.
DATA DIVISION.
FILE SECTION.
FD NNN-FILE
DATA RECORD IS NNN-RECORD.
01 NNN-RECORD PIC X(119).
FD OUT-FILE
DATA RECORD IS OUT-RECORD.
01 OUT-RECORD PIC X(256).
FD PUT-FILE
DATA RECORD IS PUT-RECORD.
01 PUT-RECORD PIC X(256).
FD PPP-FILE
DATA RECORD IS PPP-RECORD.
01 PPP-RECORD PIC X(110).
FD QQQ-FILE
DATA RECORD IS QQQ-RECORD.
01 QQQ-RECORD PIC X(110).
FD OPE-FILE
DATA RECORD IS OPE-RECORD.
01 OPE-RECORD PIC X(15).
FD FFF-FILE
DATA RECORD IS FFF-RECORD.
01 FFF-RECORD PIC X(1968).
FD LUP-FILE
DATA RECORD IS LUP-RECORD.
01 LUP-RECORD PIC X(241).
FD PP2-FILE
DATA RECORD IS PP2-RECORD.
01 PP2-RECORD PIC X(20001).
WORKING-STORAGE SECTION.
LINKAGE SECTION.
PROCEDURE DIVISION.
MAINLINE.
OPEN OUTPUT PP2-FILE.
STOP RUN.
The first thing to note is that it doesn't have a Working Storage area, so the GEN_PROC_END mnote isn't correct.
Look at it in 'old' version. Looks like the same code. The combined size of the files is 23,076 bytes. There could be additional overhead per file. But I don't know how to proceed with this one. I hope things become clearer as we proceed.
ZC390LIB.MLC is in c:\z390\z390
ZC390LIB.MLC is in c:\z390\zcobol\z390
ZC390LIB.MLC is in c:\v181\zcobol\lib
So it seems that ZC390LIB.MLC is in a different directory in V181. AZ390E error 29 (11/127)31 WTO 'ZC390LIB NOT FOUND'
look for error msg in AZ390.JAVA
I can't find the msg anywhere in the v181 JAVAs.
Found it c:\V181\zcobol\mac\GEN_ID.MAC: WTO 'ZC390LIB NOT FOUND'
also FINDSTR found c:\V181\bash\bldcbllib:# bldcbllib: rebuild zcobol/lib/ZC390LIB.390 c:\V181\bash\bldcbllib:bash/asml zcobol/lib/ZC390LIB $sysmac $syscpy $sys390 RMODE24 $1 $2 $3 $4 $5 $6 $7 $8 $9 c:\V181\bash\bldcbllib:echo "Verify ZC390LIB.390 build ok"
looks like we have to rerun the bash script to get the 390 file, which GEN_ID cannot find and therefore cannot load.
SAVE Z390\MAC LOAD Z390\MAC WTO Z390\MAC ZOPEN Z390\MAC DCBD Z390\MAC DCB Z390\MAC
SAVE V181\MAC LOAD V181\MAC WTO V181\MAC ZOPEN V181\MAC DCBD V181\MAC DCB V181\MAC
So on the surface they're the same. The "ERRSUM missing macro" emanates from AZ390.JAVA.
But in that area the z390 java and the v181 java look the same.
The checking is done in TZ390.JAVA. looked at AZ390.JAVA re ERRSUM but it's too complicated.
Maybe I ought to look at any logs in v181 to see what BAT/BASH scripts have been run supposing that the "runtime" was generated by same.
Cos I'm not using the runtime. I'm working from the "source", trying to fix problems as I go.
Or I could just try compiling CB002 et al and see what pops out. I tried compiling first dozen and they all had problems finding those MACs noted above.
I think that I might run BAT\BLDCBLLIB in v181, it might get rid of the Z390LIB.390 problem, at least.
run BAT\BLDCBLLIB.BAT in V181 with log to bldcbllib.out fell over couldn't find or load main class mz390
Look at BAT
@if /I "%1" == "tron" (echo on) else (echo off) rem rebuild zcobol\z390\zc390lib.390
setlocal if /I "%1" == "tron" (set z_TraceMode=tron shift /1 ) else (if /I "%1" == "troff" (set z_TraceMode=troff shift /1 ) else (set z_TraceMode=) ) set /A z_NestLevel=%z_NestLevel%+1 rem ----- Lvl(%z_NestLevel%) Start %0 %1 %2 %3 %4 %5 %6 %7 %8 %9
pushd %~dps0.. call bat\asm %z_TraceMode% zcobol\lib\ABORT sysmac(mac) syscpy(mac+zcobol\lib) %1 %2 %3 %4 %5 %6 %7 %8 %9 || goto error call bat\asm %z_TraceMode% zcobol\lib\ACCEPT sysmac(mac) syscpy(mac+zcobol\lib) %1 %2 %3 %4 %5 %6 %7 %8 %9 || goto error call bat\asm %z_TraceMode% zcobol\lib\CVTTOHEX sysmac(mac) syscpy(mac+zcobol\lib) %1 %2 %3 %4 %5 %6 %7 %8 %9 || goto error call bat\asm %z_TraceMode% zcobol\lib\DISPLAY sysmac(mac) syscpy(mac+zcobol\lib) %1 %2 %3 %4 %5 %6 %7 %8 %9 || goto error call bat\asm %z_TraceMode% zcobol\lib\INSPECT sysmac(mac) syscpy(mac+zcobol\lib) %1 %2 %3 %4 %5 %6 %7 %8 %9 || goto error call bat\asm %z_TraceMode% zcobol\lib\ZC390NUC sysmac(mac) syscpy(mac+zcobol\lib) %1 %2 %3 %4 %5 %6 %7 %8 %9 || goto error call bat\asml %z_TraceMode% zcobol\lib\ZC390LIB sysmac(mac) syscpy(mac+zcobol\lib) sys390(zcobol\lib) rmode24 %1 %2 %3 %4 %5 %6 %7 %8 %9 || goto error if not exist zcobol\lib\ZC390LIB.390 (set z_ReturnCode=12 echo %0 ERROR: ZC390LIB.390 was not created goto return) set z_ReturnCode=0 goto return
:error set z_ReturnCode=%ERRORLEVEL% echo %0 ERROR: Encountered RC %z_ReturnCode% - exiting :return popd rem ----- Lvl(%z_NestLevel%) End %0 %1 %2 %3 %4 %5 %6 %7 %8 %9 exit /b %z_ReturnCode%
ABORT, ACCEPT, CVTTOHEX, DISPLAY, INSPECT, ZC390NUC and ZC390LIB are all in v181\zcobol\lib where they are all MLCs
It uses BAT\ASM to run the JAVA
@if /I "%1" == "tron" (echo on) else (echo off) rem asm run macro assembly to generate relocatable obj from mlc source
setlocal if /I "%1" == "tron" (set z_TraceMode=tron shift /1 ) else (if /I "%1" == "troff" (set z_TraceMode=troff shift /1 ) else (set z_TraceMode=) ) set /A z_NestLevel=%z_NestLevel%+1 rem ----- Lvl(%z_NestLevel%) Start %0 %1 %2 %3 %4 %5 %6 %7 %8 %9
if /I %1. == . (set /P z_file=Hit Enter for help or suppply name of mlc file to assemble: ) else (set z_file=%1) if /I %z_file%. == . goto help :chkfile rem convert Unix path notation to Windows before checking the file set z_file=%z_file:/=\% if exist %z_file%.MLC goto file_ok rem if user specified valid extension, strip it off if /I %z_file:~-4%. NEQ .MLC. goto help set z_file=%z_file:~0,-4% if exist %z_file%.MLC goto file_ok echo %0 ERROR: %z_file%.MLC was not found set z_ReturnCode=16 goto return
:file_ok if exist %z_file%.BAL erase %z_file%.BAL if exist %z_file%.PRN erase %z_file%.PRN if exist %z_file%.OBJ erase %z_file%.OBJ if exist %z_file%.LST erase %z_file%.LST if exist %z_file%.390 erase %z_file%.390 if exist %z_file%.LOG erase %z_file%.LOG if exist %z_file%.ERR erase %z_file%.ERR if exist %z_file%.STA erase %z_file%.STA if exist %z_file%.TR erase %z_file%.TR
rem get the z390 directory set "z_HomeDir=%~dps0..\" for %%f in ("%z_HomeDir%") do set "z_HomeDir=%%~ff"
call %~dps0mz390 %z_TraceMode% %z_file% sysmac(+%z_HomeDir%mac) syscpy(+%z_HomeDir%mac) %2 %3 %4 %5 %6 %7 %8 %9 set z_ReturnCode=%ERRORLEVEL% rem any error or warning message has been issued by mz390 if %z_ReturnCode% NEQ 0 (if %z_ReturnCode% NEQ 4 (if exist %z_file%.OBJ (erase %z_file%.OBJ) goto return))
:return rem ----- Lvl(%z_NestLevel%) End %0 %1 %2 %3 %4 %5 %6 %7 %8 %9 exit /b %z_ReturnCode%
:help echo . echo the ASM.BAT procedure is intended to assemble a single assembler program echo . set /P z_file=Hit Enter for more help or suppply name of mlc file to assemble: if /I %z_file%. NEQ . goto chkfile
call %~dps0help %z_TraceMode% set z_ReturnCode=16 goto return
BAT/ASM.BAT invokes JAVA via "call %~dps0mz390" notepad++'ed it and added "echo %0 path to mz390 %~dps0"
reran BAT/BLDCBLLIB.BAT
It gave
bat\asm path to mz390 c:\V181\bat\ and MZ390.JAVA/CLASS aint in that location
google says that a call in a DOS BATch file is to call another DOS BATch file, so I can expect there to be a BAT\MZ390.BAT as well
@if /I "%1" == "tron" (echo on) else (echo off) rem execute mz390 runtime with java runtime options:
setlocal if /I "%1" == "tron" (set z_TraceMode=tron shift /1 ) else (if /I "%1" == "troff" (set z_TraceMode=troff shift /1 ) else (set z_TraceMode=) ) set /A z_NestLevel=%z_NestLevel%+1 rem ----- Lvl(%z_NestLevel%) Start %0 %1 %2 %3 %4 %5 %6 %7 %8 %9
if /I %1. == . (echo %0 ERROR: missing file name set z_ReturnCode=16 goto return )
rem 01/15/09 DSH added 150 MB init and max mem for zcobol rem -classpath path to jar file rem -verbose:gc trace garbage collection to detect memory leaks rem -XmsnK set initial memory allocation to nK rem -XmxnK set max memory allocation to nK rem -Xrs allow control break interruption of java tasks java -classpath %~dps0..\z390.jar -Xrs -Xms150000K -Xmx150000K %J2SEOPTIONS% mz390 %1 %2 %3 %4 %5 %6 %7 %8 %9
set z_ReturnCode=%ERRORLEVEL% if %z_ReturnCode% EQU 0 goto return if %z_ReturnCode% EQU 4 (echo %0 WARNING: See warnings on mz390 generated bal file and console goto return ) rem ErrorLevel 1 for Java issues or ErrorLevel 8 / 12 for assembly issues echo %0 ERROR: See errors on mz390 generated bal file and console
:return rem ----- Lvl(%z_NestLevel%) End %0 %1 %2 %3 %4 %5 %6 %7 %8 %9 exit /b %z_ReturnCode%
notepad++'ed BAT\MZ390.BAT to include "rem jclh /n echo %0 path to mz390 %~dps0" to it
and reran BAT\BLDCBLLIB.BAT It gave c:\V181\bat\mz390 path to mz390 c:\V181\bat\ where z390.jar is supposed to reside
Used File Explorer to look for z390.jar in v181, didn't find it. I suppose one will not find a "runtime" object in a "source" environment.
I'll have to make further changes to "source" BAT files that invoke JAVA/CLASS to point to v181/src rather than v181/bat
change BAT\MZ390.BAT to point to v181\src
REM JCLH rem java -classpath %~dps0..\z390.jar -Xrs -Xms150000K -Xmx150000K %J2SEOPTIONS% mz390 %1 %2 %3 %4 %5 %6 %7 %8 %9 echo jclh changed classpath in %0 to v181\src java -classpath v181\src\mz390 -Xrs -Xms150000K -Xmx150000K %J2SEOPTIONS% mz390 %1 %2 %3 %4 %5 %6 %7 %8 %9
create BAT/JHJAV.BAT which just runs the java class change BAT/MZ390.BAT to use it
OK let's review where we are We wanted to run BAT\BLDCBLLIB.BAT which calls ASM.BAT which calls MZ390.BAT under V181.
I got errors with BLDCBLLIB which occasioned looking at ASM which in turn led to MZ390.
I have had a lot of trouble getting JAVAC and JAVA to recognise MZ390(.CLASS), perhaps this is ongoing.
I saw above a mention of BLDCBLLIB with regard to a BASH version of BLDCBLLIB where it also mentioned the parameters to be passed.
So I need to review in v181 - BAT(or BASH)\BLDCBLLIB, BAT\ASM.BAT, BAT\MZ390.BAT to ensure that they are compatible with v181, the path, the classpath, the new directory structure, the whereabouts of the java bin files. ....
So lets go back to BLDCBLLIB
Z390 has both an MLC and a 390 file for ZC390LIB
BUT V181 only has an MLC file for ZC390LIB
AZ390E error 29 (11/127)31 WTO 'ZC390LIB NOT FOUND'
c:\V181\zcobol\mac\GEN_ID.MAC: WTO 'ZC390LIB NOT FOUND'
c:\V181\bash\bldcbllib:# bldcbllib: rebuild zcobol/lib/ZC390LIB.390 c:\V181\bash\bldcbllib:bash/asml zcobol/lib/ZC390LIB $sysmac $syscpy $sys390 RMODE24 $1 $2 $3 $4 $5 $6 $7 $8 $9 c:\V181\bash\bldcbllib:echo "Verify ZC390LIB.390 build ok"
looks like we have to rerun the bash script to get the 390 file, which GEN_ID cannot find and therefore cannot load.
Running (NUJAVCLG hacked to bits) against MZ390, it errors cos it wants and expects an MLC file, perhaps it wants V181\ZCOBOL\LIB\BLDCBLLIB.MLC, as above, cos BLDCBLLIB sounds like it is trying to Build a CBL LIBrary.
It looks like bldcbllib is calling asml not asm
But I guess I'll have to look at a lot of BATch files to see whether they need to be massaged, not just ASM and ASML.
Eventually ran MZ390 in Z390 OK, "MZ390 Z390\ZC390LIB"
REM JCLH REM set path="c:\program files\Java\jdk-17.0.1\bin" REM echo path=%path% REM echo classpath=%~p1 REM echo program= %~n1 java -classpath src -Xrs -Xms150000K -Xmx150000K %J2SEOPTIONS% mz390 %1 %2 %3 %4 %5 %6 %7 %8 %9
in V181\BAT\MZ390.BAT got TZ390E abort error 10 - systerm file open error java.lang.NullPointerException z390_abort_request ZC390LIB MZ390 TZ390E abort error 10 - systerm file open error java.lang.NullPointerException BAT\MZ390 ERROR: See errors on mz390 generated bal file and console
changed v181\src\tz390 with my z390 change // jclh abort_error(10,"systerm file open error " + systerm_file_name + e.toString()); which is the inclusion of the systerm_file_name in the error msg
jhjavc it, followed by jhjavc mz390 bat\jhjavc src\tz390 then bat\jhjavc src\mz390 ok then ok
I went thru the exercise of adding a lot of System.out.println's to TZ390, hours and hours, only to find that BAT\MZ390 LIB\ZC390LIB is wrong, it should be BAT\MZ390 ZCOBOL\LIB\ZC390LIB
Comment-out all JCLH lines in TZ390
Did that and BAT\JHJAVC SRC\TZ390 OK BAT\JHJAVC SRC\MZ390 OK BAT\MZ390 ZCOBOL\LIB\ZC390LIB OK
Hooray
Edited BAT\AZ390.BAT & BAT\EZ390.BAT to conform with "java" command in BAT\MZ390.BAT
Recapping
Run ZC181 on CB001 in V181, "UNABLE TO SET", githubbian, fixed with change to V181\SRC\TZ390.JAVA.
Run ZC181C on CB001 in V181, ZCOBOL\Z390\ZC390CLG.OPT becomes ZCOBOL\OPT\CBLOPT.OPT,
Changes needed to ZC181C and ZC181CLG.
When bat\ZC181C was run again, lo and behold, o shi......
a number of problems, 1) GEN_PROC_END 2) ZC390LIB 3) ZCVT 4) PP2 5) The files for NNN_FILE DCB DSORG=PS,RECFM=FT,BLKSIZE=0, OUT_FILE DCB DSORG=PS,RECFM=FT,BLKSIZE=0, PUT_FILE DCB DSORG=PS,RECFM=FT,BLKSIZE=0, PPP_FILE DCB DSORG=PS,RECFM=FT,BLKSIZE=0, QQQ_FILE DCB DSORG=PS,RECFM=FT,BLKSIZE=0, OPE_FILE DCB DSORG=PS,RECFM=FT,BLKSIZE=0, FFF_FILE DCB DSORG=PS,RECFM=FT,BLKSIZE=0, LUP_FILE DCB DSORG=PS,RECFM=FT,BLKSIZE=0, PP2_FILE DCB DSORG=PS,RECFM=FT,BLKSIZE=0, 6) missing macro =SAVE missing macro =LOAD missing macro =WTO missing macro =ZOPEN missing macro =DCBD missing macro =DCB 7) 3 undefined symbols, presumably in the error 198's
BLDCBLLIB creates ZC390LIB.390 from ZC390LIB.MLC
When first run, it fell over "couldn't find class mz390".
BLDCBLLIB.BAT calls ASM.BAT calls MZ390.BAT
Have to look at ASM.BAT, ASML.BAT, ASMLG.BAT
Finally BAT\MZ390 LIB\ZC390LIB wrong BAT\MZ390 ZCOBOL\LIB\ZC390LIB right
Look at ASM.BAT, ASML.BAT and ASMLG.BAT
ASM.BAT calls MZ390.BAT ASML.BAT calls MZ390.BAT and LZ390.BAT ASMLG.BAT calls MZ390.BAT, LZ390.BAT and EZ390.BAT
I haven't looked at LZ390.BAT yet, done.
And SRC\LZ390.JAVA hasn't been compiled yet? The class is there.
Run BAT\BLDCBLLIB again, LOOKS OK.
Let's run BAT\ZC181C ZCOBOL\DEMO\CB001 again. looks similar to last time.
Apart from the BLDCBLLIB, there's a BLDLIB, BLDJAR, BLDZSTRMAC.
Let's run these excluding BLDJAR.
BAT\BLDLIB ran to end without error. BAT\BLDZSTRMAC ran to end without error.
rerun BAT\ZC181C ZCOBOL\DEMO\CB001
unchanged
just found BAT\ZC390BLD.BAT, let's run that.
It's not set up to run in V181.
Calls all prefixed with BAT.
Rerun.
All Z390 changed to LIB.
Rerun. ran to end ok.
rerun BAT\ZC181C ZCOBOL\DEMO\CB001 unchanged.
I've found something else that's different, there's a whole bunch of BAT files in the ZPAR directory. I was looking for ZCCLG.BAT which I believed was the new zcobol compile bat and found it in zpar. I thought perhaps I needed to change something because some of the MACs are in V181\MAC whilst others are in V181\ZCOBOL\MAC and I thought that ZCCLG would reflect those changes.
Look at BAT\ZCCLG.BAT in the "runtime" environment which does reflect the differences with regard to the MACs.
call %~dps0ZC390 %z_TraceMode% %z_file% %2 %3 %4 %5 %6 %7 %8 %9
call %~dps0MZ390 %z_TraceMode% %z_file% @%z_HomeDir%zcobol\opt\CBLOPT sysmac(%z_HomeDir%zcobol\mac+mac) syscpy(+%z_HomeDir%zcobol\cpy) %2 %3 %4 %5 %6 %7 %8 %9
call %~dps0LZ390 %z_TraceMode% %z_file% %2 %3 %4 %5 %6 %7 %8 %9
call %~dps0EZ390 %z_TraceMode% %z_file% sys390(+%z_HomeDir%zcobol\lib) %2 %3 %4 %5 %6 %7 %8 %9
"%PF%Java\jdk-17.0.1\bin\java.exe" -Xrs zc390 %1 SYSCPY(+zcobol+zcobol\z390) %2 %3 %4 %5 %6 %7 %8 %9
"%PF%Java\jdk-17.0.1\bin\java.exe" -Xrs zc390 %1 SYSCPY(+zcobol+zcobol\z390) %2 %3 %4 %5 %6 %7 %8 %9
"%PF%Java\jdk-17.0.1\bin\java.exe" -Xrs mz390 %1 @zcobol\OPT\CBLOPT.OPT %2 %3 %4 %5 %6 %7 %8 %9
"%PF%Java\jdk-17.0.1\bin\java.exe" -Xrs zc390 %1 SYSCPY(+zcobol+zcobol\z390) %2 %3 %4 %5 %6 %7 %8 %9
"%PF%Java\jdk-17.0.1\bin\java.exe" -Xrs mz390 %1 @zcobol\z390\ZC390CLG %2 %3 %4 %5 %6 %7 %8 %9
"%PF%Java\jdk-17.0.1\bin\java.exe" -Xrs lz390 %1 SYSOBJ(+zcobol\z390) %2 %3 %4 %5 %6 %7 %8 %9
"%PF%Java\jdk-17.0.1\bin\java.exe" -Xrs zc390 %1 SYSCPY(+zcobol+zcobol\z390) %2 %3 %4 %5 %6 %7 %8 %9
"%PF%Java\jdk-17.0.1\bin\java.exe" -Xrs mz390 %1 @zcobol\z390\ZC390CLG %2 %3 %4 %5 %6 %7 %8 %9
"%PF%Java\jdk-17.0.1\bin\java.exe" -Xrs lz390 %1 SYSOBJ(+zcobol\z390) %2 %3 %4 %5 %6 %7 %8 %9
"%PF%Java\jdk-17.0.1\bin\java.exe" -Xrs ez390 %1 SYS390(+zcobol\z390) %2 %3 %4 %5 %6 %7 %8 %9
change
"%PF%Java\jdk-17.0.1\bin\java.exe" -Xrs zc390 %1 SYSCPY(+zcobol+zcobol\z390) %2 %3 %4 %5 %6 %7 %8 %9 unchanged
"%PF%Java\jdk-17.0.1\bin\java.exe" -Xrs mz390 %1 @zcobol\opt\CBLOPT sysmac(%zcobol\mac+mac) syscpy(%zcobol\cpy) %2 %3 %4 %5 %6 %7 %8 %9 changed
"%PF%Java\jdk-17.0.1\bin\java.exe" -Xrs lz390 %1 SYSOBJ(+zcobol\z390) %2 %3 %4 %5 %6 %7 %8 %9 unchanged
"%PF%Java\jdk-17.0.1\bin\java.exe" -Xrs ez390 %1 SYS390(+zcobol\lib) %2 %3 %4 %5 %6 %7 %8 %9 changed
relevant changes were made
now retry BAT\ZC181C ZCOBOL\DEMO\CB001 in V181 most of previous errors gone away, but now objecting to other MACs. Try removing % from sysmac and syscopy
now retry BAT\ZC181C ZCOBOL\DEMO\CB001 in V181 now just MZ390E error 101 (1/3)3 missing copy = CB001_ZC_LABELS.CPY MZ390E error 266 (1/3)3 missing copy = CB001_ZC_LABELS.CPY AZ390E error 144 (40/56)295 ST ZC_R0,PP2_FILE+DCBDSNAM- IHADCB
Try adding +zcobol to syscpy in BAT\ZC181C in V181
now retry BAT\ZC181C ZCOBOL\DEMO\CB001 in V181 the same errors
should have been +zcobol\demo, change & retry just AZ390E error 144 (41/56)294 ST ZC_R0,PP2_FILE+DCBDSNAM-IHADCB still remains
error144 (no base register) was occurring and resisted many attempts to fix it by moving the code around in the program. it was finally fixed by moving the FD for the file involved from the sixth position to the 4th position.
now retry BAT\ZC181C ZCOBOL\DEMO\CB001 in V181 all the errors have gone away
change BAT\ZC181CL and BAT\ZC181CLG,
remove % from sysmac and syscpy and add +zcobol\demo to syscpy
Try running the rest of my test programs Some have been omitted because they pulled the same problems as under z390 Only those that encountered new problems are shown
BAT\ZC181C ZCOBOL\DEMO\CB002 in V181
AZ390E error 42 (42/285)2148 BRAS ZC_R14,3 SET ZC_R1 TO A(INLINE LIT) AND SKIP OVER IT
/*
* symbol table global variables
*/
byte sym_sdt = 0; // dec, b'', c'', h''
byte sym_cst = 1; // CSECT )alias REL)
byte sym_dst = 2; // DSECT (alias REL)
byte sym_ent = 3; // ENTRY (alias REL)
byte sym_ext = 4; // EXTRN external link
byte sym_rel = 5; // RX (CST.DST,ENT)_
byte sym_rld = 6; // complex rld exp
byte sym_lct = 7; // loctr (changed to cst/dst).
byte sym_wxt = 8; // WXTRN weak external link RPI182
byte sym_und = 9; // undefined symbol RPI 694
001050 (1/456)1268 *ZC 139 SUBTRACT 1,FROM,DDUB1,GIVING,BUB1 001050 F20090B8D05C 0000B8 00B1FC (44/44)1269+ PACK ZCVT_PWORK2(1),0+DDUB1(1) PACK #1 NORMAL 001056 F00090B80040 0000B8 (41/1504)1270+ SRP ZCVT_PWORK2(1),64-0,0 00105C F800D0B090B8 00B250 0000B8 (41/1506)1271+ ZAP BUB1,ZCVT_PWORK2(1) 001062 (42/285)1272+ BRAS ZC_R14,3 SET ZC_R1 TO A(INLINE LIT) AND SKIP OVER IT AZ390E error 42 (42/285)1272 BRAS ZC_R14,3 SET ZC_R1 TO A(INLINE LIT) AND SKIP OVER IT AZ390I 2 invalid rel off bits 16 exp_type=0 sym_rel=5
symrel=5; // RX (CST.DST,ENT) whilst exp_type=0=sdt, that is a self-defining term
relevant working-storage lines in ZCOBOL\DEMO\CB002.CBL in V181
01 DDUB1 PIC 9(01) value 1.
01 BUB1 PIC 9(01) COMP-3 value 0.
neither field signed. IBM COBOL doesn't seem to demand they be signed. doesn't get error under "z390" environment
compared z390\zcobol\demo\cb002.prn with v181\zcobol\demo\cb002.prn at the point of error 42, the assembler is the same.
Looked at the JAVA in AZ390.JAVA, the error 42 appears in new code in V181
Only occurs on a SUBTRACT GIVING where the receiving field is COMP-3
bat\zc181c zcobol\demo\cb031 AZ390E error 193 (43/2074)251 MVI 0(6,ZC_R3),C'0' AZ390I unexpected character before close ), There’s an error in az390 in the expectation of one addressing structure When another is being received,
expecting “( something )” getting “(6,”
')' in get_hex_lbddd and get_exp_abs_bddd and get_exp_abs_v2xbddd and get_exp_abs_xbddd
the 193 is in get_exp_abs_bddd
I suspect that get_exp_abs_xbddd may have the correct shape (the xbddd shape) to fit 0(6,zc_r3) Though I’m a complete novice in these areas
bat\zc181c zcobol\demo\cb037 MZ390E MNOTE 8,'GEN_PROC_END WS LENGTH ERROR= 4'
It was an error in GEN_PROC_END.MAC
AZ390E error 17 (44/213)424 BRUCE5 DC AL2(1234+) RPI 1065 when zcobol DISPLAYs a single COMP variable, either explicit positive sign or negative sign
bat\zc181c zcobol\demo\cb046 AZ390E error 98 (36/75)262 IILF ZC_R7,WSADDR9-WS characters ZC missing from beginning of WS in GEN_BASE.MAC
bat\zc181c zcobol\demo\cb063 AZ390E error 98 (42/75)612 IILF ZC_R7,RETURN_CODE-WS see above
bat\zc181c zcobol\demo\cb068 MZ390E MNOTE 8,'ZC_CALC MISSING VAR STACK PTR' I suspect that the error occurs with unary signs (+ or -) in a COMPUTE.
bat\zc181c zcobol\demo\cb070 MZ390E MNOTE 8,'ZC_CALC MISSING VAR STACK PTR' see above
bat\zc181c zcobol\demo\cb079 MZ390E MNOTE 8,'ZC_CALC MISSING VAR STACK PTR' see above
That completes the testing of my CBnnn.CBL test programs.
STARTING TESTING OF DB2 PORTING PROJECT
Ran DB2PREPY under v181 crash
You have to run BAT\DB2PREPY TESTALL2
The GEN_PROC_END problem that occurred in z390
Doesn’t occur in z181, so had to remove my fix from v181.
Re-ran BAT\DB2PREPY TESTALL2 in v181, the GEN_PROC_END problem Has gone away, but now objects about zc181c on testall2, need to change DB2PREPY.BAT again to prefix ZC181C with BAT.
Reran BAT\DB2PREPY TESTALL2 SQLCA.CPY is missing, so copy if into v181\zcobol\demo from z390\zcobol\demo But it’s called SQLCA.CPZ. Copied OK.
Reran BAT\DB2PREPY TESTALL2 Ran OK.
Now on to DB2PREPZ, so lets have a look at it. Added BAT\ as prefix and changed ZC390J toZC181CLG
Ran BAT\DB2PREPZ missing target program name, so BAT\DB2PREPZ TESTALL2 had to change CD C:\Z390 to CD C:\V181 BAT\DB2PREPZ TESTALL2,JH,TES2,CHOOKY
DB2PREPZ massaged, RUTE=C:\V181
The DB2PREPZ.CBL itself needs massage in respect of the generated CMD lines BAT\ prefix added twice and compiled OK.
Now we have to massage BAT\DB2CRE8.BAT , RUTE plus ZC181CLG
It ran to the end and I couldn’t see any errors, look at the generated CBLs
And they all look OK.
Now NUATEST.BAT massage it.
SQUELCH5 calls WREAD1 which uses SQL.BAT, it expects it to be under C:\Z390 but it’s getting written under C:\V181 – change BAT\NUATEST.BAT.
DB2PREPY TESTALL2 OK DB2PREPZ TESTALL2,JH,TES2,CHOOKY OK NUATEST TESTALL2,CHOOKY OK
DB2PREPY TESTALL3 OK DB2PREPZ TESTALL3,JH,TES2,CHOOKY OK NUATEST TESTALL3,CHOOKY OK
DB2PREPY TESTALL4 OK DB2PREPZ TESTALL4,JH,TES4,CHOOKY OK It generates 18 new CBLs NUATEST TESTALL4,CHOOKY S80A can’t cope
DB2PREPY TESTALL5 OK DB2PREPZ TESTALL5,JH,TES5,CHOOKY OK NUATEST TESTALL5,CHOOKY OK
DB2PREPY TESTALL6 OK DB2PREPZ TESTALL6,JH,TES6,CHOOKY OK NUATEST TESTALL6,CHOOKY Doesn’t like a SENSITIVE STATIC SCROLL CURSOR Same in z390
DB2PREPY TESTALL7 OK DB2PREPZ TESTALL7,JH,TES5,CHOOKY OK NUATEST TESTALL7,CHOOKY OK
DB2PREPY TESTALL8 OK DB2PREPZ TESTALL8,JH,TES8,CHOOKY OK NUATEST TESTALL8,CHOOKY OK
DB2PREPY TESTALL9 OK DB2PREPZ TESTALL9,JH,TES9,CHOOKY cannot cope with SQL command Same in z390 (an SQL WITH)
V181 IMPLEMENTATION 6TH JANUARY 2023 JCLH ==================== ================ ====
This document represents my journey through testing my programs against the environment represented by the latest release of z390.
Since I changed some javas amongst az390, ez390, lz390, mz390, pz390, sz390, tz390. zc390, z390, I can't use the JAR in my testing, so everything will need adjusting to access my javas.
The new version of Z390, as appears in the download of v1.8.1, is different from that which I am used to.
The document was intended as an aide memoire for self, rather than to be understandable by a wider audience. So please forgive any errors, snafus and omissions.
v1.8.1 has a "source" download, which for instance would have CBL but wouldn't have been compiled, so it wouldn't have MLC, BAL, 390, ERR, PRN etc. files.
v1.8.1 has a "runtime" download, which at this point of time hasn't really been investigated, but I note that there isn't a directory for SRC, i.e. JAVA files don't appear in the "runtime".
I want eventually to "deliver" the consumables from my DB2 porting project to Z390 thru Abe and hopefully on to z390 proper, perhaps thru github, but I realise that my stuff doesn't match v181.
So I have downloaded "source" into c:\v181, whereas in the release I am familiar with, it was c:\z390.
I will make what changes are necessary to "v181", to allow the CB001 thru CB094 set of CBLs to be OK.
I note already that BAT files instead of being in the "root" directory, formerly Z390, are in v181\BAT directory.
So I have copied ZC390, ZC390C. ZC390CL and ZC390CL across from z390 "root" to v181\BAT where they have been renamed as ZC181, ZC181C, ZC181CL and ZC181CL.
And changed internally, so that instead of getting the "old" versions in z390.jar, they pick up the newly compiled versions of the necessary JAVAs, that were in the old JAR.
Also, I nearly forgot, I have copied the files that I deemed were necessary for the CBnnn's and the DB2's across to v181.
When first I tried to run ZC181 in v181 (cd c:\v181, bat\ZC181ZCOBOL\DEMO\CB001), I immediately struck my first problem, "unable to set" which emanated from the v181 version of TZ390.JAVA, which was looking for the "properties" file, which I discovered was something githubbian. To temporarily get around this problem, I did a change to it to comment out the "method of "getVersion" and replace it with "v1.8.1" and to recompile it.
That nasty message dissolved.
bat\zc181 zcobol\demo\cb001 seemed to work, no other errors were reported.
But don't get too excited, when I tried bat\zc181c, it spat the dummy, because the new directory structure had struc(k)-tured again. ZC390CLG.OPT couldn't be found in the ZCOBOL\Z390 directory, because the directory had been renamed as the ZCOBOL\OPT directory and the file itself was renamed from ZC390CLG.OPT to CBLOPT.OPT, that entailed changes to bat\ZC181C.BAT to point to the new option file (note to self, I'll need to make the same changes to ZC181CL and ZC181CLG).
I just remembered that MACs were in various places in the "old" version, now they have been centralized into v181\MAC, that will cause problems.
When bat\ZC181C was run again, lo and behold, o shi...... a number of problems,
1) GEN_PROC_END 2) ZC390LIB 3) ZCVT 4) PP2 5) The files for NNN_FILE DCB DSORG=PS,RECFM=FT,BLKSIZE=0, OUT_FILE DCB DSORG=PS,RECFM=FT,BLKSIZE=0, PUT_FILE DCB DSORG=PS,RECFM=FT,BLKSIZE=0, PPP_FILE DCB DSORG=PS,RECFM=FT,BLKSIZE=0, QQQ_FILE DCB DSORG=PS,RECFM=FT,BLKSIZE=0, OPE_FILE DCB DSORG=PS,RECFM=FT,BLKSIZE=0, FFF_FILE DCB DSORG=PS,RECFM=FT,BLKSIZE=0, LUP_FILE DCB DSORG=PS,RECFM=FT,BLKSIZE=0, PP2_FILE DCB DSORG=PS,RECFM=FT,BLKSIZE=0, 6) missing macro =SAVE missing macro =LOAD missing macro =WTO missing macro =ZOPEN missing macro =DCBD missing macro =DCB 7) 3 undefined symbols, presumably in the error 198's
Whatever they are about, I'm sure that I'm just about to find out.
c:\V181>rem ZC181C translate CBL to MLC and assemble using z390
c:\V181>echo off
01:55:56 cb001 ZC390 START USING z390 V1.8.1 ON J2SE 17.0.1 01/06/23
01:55:56 cb001 ZC390 ENDED RC= 0 SEC= 0 MEM(MB)= 9 IO=2
01:55:56 cb001 MZ390 START USING z390 V1.8.1 ON J2SE 17.0.1 01/06/23
MZ390E MNOTE 8,'GEN_PROC_END WS LENGTH ERROR = 949'
AZ390E error 29 (11/75)10 SAVE (14,12)
AZ390E error 29 (11/124)28 LOAD EP=ZC390LIB
AZ390E error 29 (11/127)31 WTO 'ZC390LIB NOT FOUND'
AZ390E error 29 (11/141)45 WTO 'ZC390LIB ZCVT VERIFY ERROR'
AZ390E error 198 (38/44)284 STH ZC_R0,PP2_FILE+DCBBLKSI-IHADCB
AZ390E error 198 (38/56)286 ST ZC_R0,PP2_FILE+DCBDSNAM-IHADCB
AZ390E error 198 (38/66)288 MVC DCBMACRF-IHADCB+PP2_FILE,0(ZC_R1)
AZ390E error 29 (38/73)289 ZOPEN (PP2_FILE,(OUTPUT))
AZ390E error 98 (38/65)287 LARL ZC_R1,=AL2(DCBMACRF_PM)
AZ390E error 29 (45/385)408 DCBD , RPI 1048
AZ390E error 29 (45/387)409 NNN_FILE DCB DSORG=PS,RECFM=FT,BLKSIZE=0,
AZ390E error 29 (45/387)413 OUT_FILE DCB DSORG=PS,RECFM=FT,BLKSIZE=0,
AZ390E error 29 (45/387)415 PUT_FILE DCB DSORG=PS,RECFM=FT,BLKSIZE=0,
AZ390E error 29 (45/387)417 PPP_FILE DCB DSORG=PS,RECFM=FT,BLKSIZE=0,
AZ390E error 29 (45/387)419 QQQ_FILE DCB DSORG=PS,RECFM=FT,BLKSIZE=0,
AZ390E error 29 (45/387)421 OPE_FILE DCB DSORG=PS,RECFM=FT,BLKSIZE=0,
AZ390E error 29 (45/387)423 FFF_FILE DCB DSORG=PS,RECFM=FT,BLKSIZE=0,
AZ390E error 29 (45/387)425 LUP_FILE DCB DSORG=PS,RECFM=FT,BLKSIZE=0,
AZ390E error 29 (45/387)427 PP2_FILE DCB DSORG=PS,RECFM=FT,BLKSIZE=0,
AZ390E ERRSUM Critical Error Summary Option
AZ390E ERRSUM Fix and repeat until all nested errors resolved
AZ390E ERRSUM missing macro =SAVE
AZ390E ERRSUM missing macro =LOAD
AZ390E ERRSUM missing macro =WTO
AZ390E ERRSUM missing macro =ZOPEN
AZ390E ERRSUM missing macro =DCBD
AZ390E ERRSUM missing macro =DCB
AZ390E ERRSUM total missing copy files =0
AZ390E ERRSUM total missing macro files =6
AZ390E ERRSUM total undefined symbols =3
AZ390E ERRSUM total mz390 errors = 0
AZ390E ERRSUM total az390 errors = 19
01:55:57 cb001 MZ390 ENDED RC=12 SEC= 0 MEM(MB)=117 IO=26617
Press any key to continue . . .
Let's have a look at v181/src for any JAVAs I haven't compiled. I seem to have compiled them all yesterday.
They have been compared with the desktop new source and a winmerge report has been generated for each of them, proving that any changes that I made were to the desktop versions not to the old z390 versions. Thus the classes in v181/src are correct.
MZ390E MNOTE 8,'GEN_PROC_END WS LENGTH ERROR = 949' occurs where WS is bigger than expected?
IDENTIFICATION DIVISION.
PROGRAM-ID. CB001.
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT NNN-FILE
ASSIGN TO 'ZCOBOL\DEMO\M6D.NNN'
ORGANIZATION IS LINE SEQUENTIAL.
SELECT OUT-FILE
ASSIGN TO 'ZCOBOL\DEMO\M3.OUT'
ORGANIZATION IS LINE SEQUENTIAL.
SELECT PUT-FILE
ASSIGN TO 'ZCOBOL\DEMO\NAVIG8OR.PUT'
ORGANIZATION IS LINE SEQUENTIAL.
SELECT PPP-FILE
ASSIGN TO 'ZCOBOL\DEMO\M2.PPP'
ORGANIZATION IS LINE SEQUENTIAL.
SELECT QQQ-FILE
ASSIGN TO 'ZCOBOL\DEMO\NAVIG8OR.QQQ'
ORGANIZATION IS LINE SEQUENTIAL.
SELECT OPE-FILE
ASSIGN TO 'ZCOBOL\DEMO\M7.OPE'
ORGANIZATION IS LINE SEQUENTIAL.
SELECT FFF-FILE
ASSIGN TO 'ZCOBOL\DEMO\NAVIG8OR.FFF'
ORGANIZATION IS LINE SEQUENTIAL.
SELECT LUP-FILE
ASSIGN TO 'ZCOBOL\DEMO\M7.LUP'
ORGANIZATION IS LINE SEQUENTIAL.
SELECT PP2-FILE
ASSIGN TO 'ZCOBOL\DEMO\M2.PP2'
ORGANIZATION IS LINE SEQUENTIAL.
DATA DIVISION.
FILE SECTION.
FD NNN-FILE
DATA RECORD IS NNN-RECORD.
01 NNN-RECORD PIC X(119).
FD OUT-FILE
DATA RECORD IS OUT-RECORD.
01 OUT-RECORD PIC X(256).
FD PUT-FILE
DATA RECORD IS PUT-RECORD.
01 PUT-RECORD PIC X(256).
FD PPP-FILE
DATA RECORD IS PPP-RECORD.
01 PPP-RECORD PIC X(110).
FD QQQ-FILE
DATA RECORD IS QQQ-RECORD.
01 QQQ-RECORD PIC X(110).
FD OPE-FILE
DATA RECORD IS OPE-RECORD.
01 OPE-RECORD PIC X(15).
FD FFF-FILE
DATA RECORD IS FFF-RECORD.
01 FFF-RECORD PIC X(1968).
FD LUP-FILE
DATA RECORD IS LUP-RECORD.
01 LUP-RECORD PIC X(241).
FD PP2-FILE
DATA RECORD IS PP2-RECORD.
01 PP2-RECORD PIC X(20001).
WORKING-STORAGE SECTION.
LINKAGE SECTION.
PROCEDURE DIVISION.
MAINLINE.
OPEN OUTPUT PP2-FILE.
STOP RUN.
The first thing to note is that it doesn't have a Working Storage area, so the GEN_PROC_END mnote isn't correct.
Look at it in 'old' version. Looks like the same code. The combined size of the files is 23,076 bytes. There could be additional overhead per file. But I don't know how to proceed with this one. I hope things become clearer as we proceed.
ZC390LIB.MLC is in c:\z390\z390
ZC390LIB.MLC is in c:\z390\zcobol\z390
ZC390LIB.MLC is in c:\v181\zcobol\lib
So it seems that ZC390LIB.MLC is in a different directory in V181. AZ390E error 29 (11/127)31 WTO 'ZC390LIB NOT FOUND'
look for error msg in AZ390.JAVA
I can't find the msg anywhere in the v181 JAVAs.
Found it c:\V181\zcobol\mac\GEN_ID.MAC: WTO 'ZC390LIB NOT FOUND'
also FINDSTR found c:\V181\bash\bldcbllib:# bldcbllib: rebuild zcobol/lib/ZC390LIB.390 c:\V181\bash\bldcbllib:bash/asml zcobol/lib/ZC390LIB $sysmac $syscpy $sys390 RMODE24 $1 $2 $3 $4 $5 $6 $7 $8 $9 c:\V181\bash\bldcbllib:echo "Verify ZC390LIB.390 build ok"
looks like we have to rerun the bash script to get the 390 file, which GEN_ID cannot find and therefore cannot load.
SAVE Z390\MAC LOAD Z390\MAC WTO Z390\MAC ZOPEN Z390\MAC DCBD Z390\MAC DCB Z390\MAC
SAVE V181\MAC LOAD V181\MAC WTO V181\MAC ZOPEN V181\MAC DCBD V181\MAC DCB V181\MAC
So on the surface they're the same. The "ERRSUM missing macro" emanates from AZ390.JAVA.
But in that area the z390 java and the v181 java look the same.
The checking is done in TZ390.JAVA. looked at AZ390.JAVA re ERRSUM but it's too complicated.
Maybe I ought to look at any logs in v181 to see what BAT/BASH scripts have been run supposing that the "runtime" was generated by same.
Cos I'm not using the runtime. I'm working from the "source", trying to fix problems as I go.
Or I could just try compiling CB002 et al and see what pops out. I tried compiling first dozen and they all had problems finding those MACs noted above.
I think that I might run BAT\BLDCBLLIB in v181, it might get rid of the Z390LIB.390 problem, at least.
run BAT\BLDCBLLIB.BAT in V181 with log to bldcbllib.out fell over couldn't find or load main class mz390
Look at BAT
@if /I "%1" == "tron" (echo on) else (echo off) rem rebuild zcobol\z390\zc390lib.390
setlocal if /I "%1" == "tron" (set z_TraceMode=tron shift /1 ) else (if /I "%1" == "troff" (set z_TraceMode=troff shift /1 ) else (set z_TraceMode=) ) set /A z_NestLevel=%z_NestLevel%+1 rem ----- Lvl(%z_NestLevel%) Start %0 %1 %2 %3 %4 %5 %6 %7 %8 %9
pushd %~dps0.. call bat\asm %z_TraceMode% zcobol\lib\ABORT sysmac(mac) syscpy(mac+zcobol\lib) %1 %2 %3 %4 %5 %6 %7 %8 %9 || goto error call bat\asm %z_TraceMode% zcobol\lib\ACCEPT sysmac(mac) syscpy(mac+zcobol\lib) %1 %2 %3 %4 %5 %6 %7 %8 %9 || goto error call bat\asm %z_TraceMode% zcobol\lib\CVTTOHEX sysmac(mac) syscpy(mac+zcobol\lib) %1 %2 %3 %4 %5 %6 %7 %8 %9 || goto error call bat\asm %z_TraceMode% zcobol\lib\DISPLAY sysmac(mac) syscpy(mac+zcobol\lib) %1 %2 %3 %4 %5 %6 %7 %8 %9 || goto error call bat\asm %z_TraceMode% zcobol\lib\INSPECT sysmac(mac) syscpy(mac+zcobol\lib) %1 %2 %3 %4 %5 %6 %7 %8 %9 || goto error call bat\asm %z_TraceMode% zcobol\lib\ZC390NUC sysmac(mac) syscpy(mac+zcobol\lib) %1 %2 %3 %4 %5 %6 %7 %8 %9 || goto error call bat\asml %z_TraceMode% zcobol\lib\ZC390LIB sysmac(mac) syscpy(mac+zcobol\lib) sys390(zcobol\lib) rmode24 %1 %2 %3 %4 %5 %6 %7 %8 %9 || goto error if not exist zcobol\lib\ZC390LIB.390 (set z_ReturnCode=12 echo %0 ERROR: ZC390LIB.390 was not created goto return) set z_ReturnCode=0 goto return
:error set z_ReturnCode=%ERRORLEVEL% echo %0 ERROR: Encountered RC %z_ReturnCode% - exiting :return popd rem ----- Lvl(%z_NestLevel%) End %0 %1 %2 %3 %4 %5 %6 %7 %8 %9 exit /b %z_ReturnCode%
ABORT, ACCEPT, CVTTOHEX, DISPLAY, INSPECT, ZC390NUC and ZC390LIB are all in v181\zcobol\lib where they are all MLCs
It uses BAT\ASM to run the JAVA
@if /I "%1" == "tron" (echo on) else (echo off) rem asm run macro assembly to generate relocatable obj from mlc source
setlocal if /I "%1" == "tron" (set z_TraceMode=tron shift /1 ) else (if /I "%1" == "troff" (set z_TraceMode=troff shift /1 ) else (set z_TraceMode=) ) set /A z_NestLevel=%z_NestLevel%+1 rem ----- Lvl(%z_NestLevel%) Start %0 %1 %2 %3 %4 %5 %6 %7 %8 %9
if /I %1. == . (set /P z_file=Hit Enter for help or suppply name of mlc file to assemble: ) else (set z_file=%1) if /I %z_file%. == . goto help :chkfile rem convert Unix path notation to Windows before checking the file set z_file=%z_file:/=\% if exist %z_file%.MLC goto file_ok rem if user specified valid extension, strip it off if /I %z_file:~-4%. NEQ .MLC. goto help set z_file=%z_file:~0,-4% if exist %z_file%.MLC goto file_ok echo %0 ERROR: %z_file%.MLC was not found set z_ReturnCode=16 goto return
:file_ok if exist %z_file%.BAL erase %z_file%.BAL if exist %z_file%.PRN erase %z_file%.PRN if exist %z_file%.OBJ erase %z_file%.OBJ if exist %z_file%.LST erase %z_file%.LST if exist %z_file%.390 erase %z_file%.390 if exist %z_file%.LOG erase %z_file%.LOG if exist %z_file%.ERR erase %z_file%.ERR if exist %z_file%.STA erase %z_file%.STA if exist %z_file%.TR erase %z_file%.TR
rem get the z390 directory set "z_HomeDir=%~dps0..\" for %%f in ("%z_HomeDir%") do set "z_HomeDir=%%~ff"
call %~dps0mz390 %z_TraceMode% %z_file% sysmac(+%z_HomeDir%mac) syscpy(+%z_HomeDir%mac) %2 %3 %4 %5 %6 %7 %8 %9 set z_ReturnCode=%ERRORLEVEL% rem any error or warning message has been issued by mz390 if %z_ReturnCode% NEQ 0 (if %z_ReturnCode% NEQ 4 (if exist %z_file%.OBJ (erase %z_file%.OBJ) goto return))
:return rem ----- Lvl(%z_NestLevel%) End %0 %1 %2 %3 %4 %5 %6 %7 %8 %9 exit /b %z_ReturnCode%
:help echo . echo the ASM.BAT procedure is intended to assemble a single assembler program echo . set /P z_file=Hit Enter for more help or suppply name of mlc file to assemble: if /I %z_file%. NEQ . goto chkfile
call %~dps0help %z_TraceMode% set z_ReturnCode=16 goto return
BAT/ASM.BAT invokes JAVA via "call %~dps0mz390" notepad++'ed it and added "echo %0 path to mz390 %~dps0"
reran BAT/BLDCBLLIB.BAT
It gave
bat\asm path to mz390 c:\V181\bat\ and MZ390.JAVA/CLASS aint in that location
google says that a call in a DOS BATch file is to call another DOS BATch file, so I can expect there to be a BAT\MZ390.BAT as well
@if /I "%1" == "tron" (echo on) else (echo off) rem execute mz390 runtime with java runtime options:
setlocal if /I "%1" == "tron" (set z_TraceMode=tron shift /1 ) else (if /I "%1" == "troff" (set z_TraceMode=troff shift /1 ) else (set z_TraceMode=) ) set /A z_NestLevel=%z_NestLevel%+1 rem ----- Lvl(%z_NestLevel%) Start %0 %1 %2 %3 %4 %5 %6 %7 %8 %9
if /I %1. == . (echo %0 ERROR: missing file name set z_ReturnCode=16 goto return )
rem 01/15/09 DSH added 150 MB init and max mem for zcobol rem -classpath path to jar file rem -verbose:gc trace garbage collection to detect memory leaks rem -XmsnK set initial memory allocation to nK rem -XmxnK set max memory allocation to nK rem -Xrs allow control break interruption of java tasks java -classpath %~dps0..\z390.jar -Xrs -Xms150000K -Xmx150000K %J2SEOPTIONS% mz390 %1 %2 %3 %4 %5 %6 %7 %8 %9
set z_ReturnCode=%ERRORLEVEL% if %z_ReturnCode% EQU 0 goto return if %z_ReturnCode% EQU 4 (echo %0 WARNING: See warnings on mz390 generated bal file and console goto return ) rem ErrorLevel 1 for Java issues or ErrorLevel 8 / 12 for assembly issues echo %0 ERROR: See errors on mz390 generated bal file and console
:return rem ----- Lvl(%z_NestLevel%) End %0 %1 %2 %3 %4 %5 %6 %7 %8 %9 exit /b %z_ReturnCode%
notepad++'ed BAT\MZ390.BAT to include "rem jclh /n echo %0 path to mz390 %~dps0" to it
and reran BAT\BLDCBLLIB.BAT It gave c:\V181\bat\mz390 path to mz390 c:\V181\bat\ where z390.jar is supposed to reside
Used File Explorer to look for z390.jar in v181, didn't find it. I suppose one will not find a "runtime" object in a "source" environment.
I'll have to make further changes to "source" BAT files that invoke JAVA/CLASS to point to v181/src rather than v181/bat
change BAT\MZ390.BAT to point to v181\src
REM JCLH rem java -classpath %~dps0..\z390.jar -Xrs -Xms150000K -Xmx150000K %J2SEOPTIONS% mz390 %1 %2 %3 %4 %5 %6 %7 %8 %9 echo jclh changed classpath in %0 to v181\src java -classpath v181\src\mz390 -Xrs -Xms150000K -Xmx150000K %J2SEOPTIONS% mz390 %1 %2 %3 %4 %5 %6 %7 %8 %9
create BAT/JHJAV.BAT which just runs the java class change BAT/MZ390.BAT to use it
OK let's review where we are We wanted to run BAT\BLDCBLLIB.BAT which calls ASM.BAT which calls MZ390.BAT under V181.
I got errors with BLDCBLLIB which occasioned looking at ASM which in turn led to MZ390.
I have had a lot of trouble getting JAVAC and JAVA to recognise MZ390(.CLASS), perhaps this is ongoing.
I saw above a mention of BLDCBLLIB with regard to a BASH version of BLDCBLLIB where it also mentioned the parameters to be passed.
So I need to review in v181 - BAT(or BASH)\BLDCBLLIB, BAT\ASM.BAT, BAT\MZ390.BAT to ensure that they are compatible with v181, the path, the classpath, the new directory structure, the whereabouts of the java bin files. ....
So lets go back to BLDCBLLIB
Z390 has both an MLC and a 390 file for ZC390LIB
BUT V181 only has an MLC file for ZC390LIB
AZ390E error 29 (11/127)31 WTO 'ZC390LIB NOT FOUND'
c:\V181\zcobol\mac\GEN_ID.MAC: WTO 'ZC390LIB NOT FOUND'
c:\V181\bash\bldcbllib:# bldcbllib: rebuild zcobol/lib/ZC390LIB.390 c:\V181\bash\bldcbllib:bash/asml zcobol/lib/ZC390LIB $sysmac $syscpy $sys390 RMODE24 $1 $2 $3 $4 $5 $6 $7 $8 $9 c:\V181\bash\bldcbllib:echo "Verify ZC390LIB.390 build ok"
looks like we have to rerun the bash script to get the 390 file, which GEN_ID cannot find and therefore cannot load.
Running (NUJAVCLG hacked to bits) against MZ390, it errors cos it wants and expects an MLC file, perhaps it wants V181\ZCOBOL\LIB\BLDCBLLIB.MLC, as above, cos BLDCBLLIB sounds like it is trying to Build a CBL LIBrary.
It looks like bldcbllib is calling asml not asm
But I guess I'll have to look at a lot of BATch files to see whether they need to be massaged, not just ASM and ASML.
Eventually ran MZ390 in Z390 OK, "MZ390 Z390\ZC390LIB"
REM JCLH REM set path="c:\program files\Java\jdk-17.0.1\bin" REM echo path=%path% REM echo classpath=%~p1 REM echo program= %~n1 java -classpath src -Xrs -Xms150000K -Xmx150000K %J2SEOPTIONS% mz390 %1 %2 %3 %4 %5 %6 %7 %8 %9
in V181\BAT\MZ390.BAT got TZ390E abort error 10 - systerm file open error java.lang.NullPointerException z390_abort_request ZC390LIB MZ390 TZ390E abort error 10 - systerm file open error java.lang.NullPointerException BAT\MZ390 ERROR: See errors on mz390 generated bal file and console
changed v181\src\tz390 with my z390 change // jclh abort_error(10,"systerm file open error " + systerm_file_name + e.toString()); which is the inclusion of the systerm_file_name in the error msg
jhjavc it, followed by jhjavc mz390 bat\jhjavc src\tz390 then bat\jhjavc src\mz390 ok then ok
I went thru the exercise of adding a lot of System.out.println's to TZ390, hours and hours, only to find that BAT\MZ390 LIB\ZC390LIB is wrong, it should be BAT\MZ390 ZCOBOL\LIB\ZC390LIB
Comment-out all JCLH lines in TZ390
Did that and BAT\JHJAVC SRC\TZ390 OK BAT\JHJAVC SRC\MZ390 OK BAT\MZ390 ZCOBOL\LIB\ZC390LIB OK
Hooray
Edited BAT\AZ390.BAT & BAT\EZ390.BAT to conform with "java" command in BAT\MZ390.BAT
Recapping
Run ZC181 on CB001 in V181, "UNABLE TO SET", githubbian, fixed with change to V181\SRC\TZ390.JAVA.
Run ZC181C on CB001 in V181, ZCOBOL\Z390\ZC390CLG.OPT becomes ZCOBOL\OPT\CBLOPT.OPT,
Changes needed to ZC181C and ZC181CLG.
When bat\ZC181C was run again, lo and behold, o shi......
a number of problems, 1) GEN_PROC_END 2) ZC390LIB 3) ZCVT 4) PP2 5) The files for NNN_FILE DCB DSORG=PS,RECFM=FT,BLKSIZE=0, OUT_FILE DCB DSORG=PS,RECFM=FT,BLKSIZE=0, PUT_FILE DCB DSORG=PS,RECFM=FT,BLKSIZE=0, PPP_FILE DCB DSORG=PS,RECFM=FT,BLKSIZE=0, QQQ_FILE DCB DSORG=PS,RECFM=FT,BLKSIZE=0, OPE_FILE DCB DSORG=PS,RECFM=FT,BLKSIZE=0, FFF_FILE DCB DSORG=PS,RECFM=FT,BLKSIZE=0, LUP_FILE DCB DSORG=PS,RECFM=FT,BLKSIZE=0, PP2_FILE DCB DSORG=PS,RECFM=FT,BLKSIZE=0, 6) missing macro =SAVE missing macro =LOAD missing macro =WTO missing macro =ZOPEN missing macro =DCBD missing macro =DCB 7) 3 undefined symbols, presumably in the error 198's
BLDCBLLIB creates ZC390LIB.390 from ZC390LIB.MLC
When first run, it fell over "couldn't find class mz390".
BLDCBLLIB.BAT calls ASM.BAT calls MZ390.BAT
Have to look at ASM.BAT, ASML.BAT, ASMLG.BAT
Finally BAT\MZ390 LIB\ZC390LIB wrong BAT\MZ390 ZCOBOL\LIB\ZC390LIB right
Look at ASM.BAT, ASML.BAT and ASMLG.BAT
ASM.BAT calls MZ390.BAT ASML.BAT calls MZ390.BAT and LZ390.BAT ASMLG.BAT calls MZ390.BAT, LZ390.BAT and EZ390.BAT
I haven't looked at LZ390.BAT yet, done.
And SRC\LZ390.JAVA hasn't been compiled yet? The class is there.
Run BAT\BLDCBLLIB again, LOOKS OK.
Let's run BAT\ZC181C ZCOBOL\DEMO\CB001 again. looks similar to last time.
Apart from the BLDCBLLIB, there's a BLDLIB, BLDJAR, BLDZSTRMAC.
Let's run these excluding BLDJAR.
BAT\BLDLIB ran to end without error. BAT\BLDZSTRMAC ran to end without error.
rerun BAT\ZC181C ZCOBOL\DEMO\CB001
unchanged
just found BAT\ZC390BLD.BAT, let's run that.
It's not set up to run in V181.
Calls all prefixed with BAT.
Rerun.
All Z390 changed to LIB.
Rerun. ran to end ok.
rerun BAT\ZC181C ZCOBOL\DEMO\CB001 unchanged.
I've found something else that's different, there's a whole bunch of BAT files in the ZPAR directory. I was looking for ZCCLG.BAT which I believed was the new zcobol compile bat and found it in zpar. I thought perhaps I needed to change something because some of the MACs are in V181\MAC whilst others are in V181\ZCOBOL\MAC and I thought that ZCCLG would reflect those changes.
Look at BAT\ZCCLG.BAT in the "runtime" environment which does reflect the differences with regard to the MACs.
call %~dps0ZC390 %z_TraceMode% %z_file% %2 %3 %4 %5 %6 %7 %8 %9
call %~dps0MZ390 %z_TraceMode% %z_file% @%z_HomeDir%zcobol\opt\CBLOPT sysmac(%z_HomeDir%zcobol\mac+mac) syscpy(+%z_HomeDir%zcobol\cpy) %2 %3 %4 %5 %6 %7 %8 %9
call %~dps0LZ390 %z_TraceMode% %z_file% %2 %3 %4 %5 %6 %7 %8 %9
call %~dps0EZ390 %z_TraceMode% %z_file% sys390(+%z_HomeDir%zcobol\lib) %2 %3 %4 %5 %6 %7 %8 %9
"%PF%Java\jdk-17.0.1\bin\java.exe" -Xrs zc390 %1 SYSCPY(+zcobol+zcobol\z390) %2 %3 %4 %5 %6 %7 %8 %9
"%PF%Java\jdk-17.0.1\bin\java.exe" -Xrs zc390 %1 SYSCPY(+zcobol+zcobol\z390) %2 %3 %4 %5 %6 %7 %8 %9
"%PF%Java\jdk-17.0.1\bin\java.exe" -Xrs mz390 %1 @zcobol\OPT\CBLOPT.OPT %2 %3 %4 %5 %6 %7 %8 %9
"%PF%Java\jdk-17.0.1\bin\java.exe" -Xrs zc390 %1 SYSCPY(+zcobol+zcobol\z390) %2 %3 %4 %5 %6 %7 %8 %9
"%PF%Java\jdk-17.0.1\bin\java.exe" -Xrs mz390 %1 @zcobol\z390\ZC390CLG %2 %3 %4 %5 %6 %7 %8 %9
"%PF%Java\jdk-17.0.1\bin\java.exe" -Xrs lz390 %1 SYSOBJ(+zcobol\z390) %2 %3 %4 %5 %6 %7 %8 %9
"%PF%Java\jdk-17.0.1\bin\java.exe" -Xrs zc390 %1 SYSCPY(+zcobol+zcobol\z390) %2 %3 %4 %5 %6 %7 %8 %9
"%PF%Java\jdk-17.0.1\bin\java.exe" -Xrs mz390 %1 @zcobol\z390\ZC390CLG %2 %3 %4 %5 %6 %7 %8 %9
"%PF%Java\jdk-17.0.1\bin\java.exe" -Xrs lz390 %1 SYSOBJ(+zcobol\z390) %2 %3 %4 %5 %6 %7 %8 %9
"%PF%Java\jdk-17.0.1\bin\java.exe" -Xrs ez390 %1 SYS390(+zcobol\z390) %2 %3 %4 %5 %6 %7 %8 %9
change
"%PF%Java\jdk-17.0.1\bin\java.exe" -Xrs zc390 %1 SYSCPY(+zcobol+zcobol\z390) %2 %3 %4 %5 %6 %7 %8 %9 unchanged
"%PF%Java\jdk-17.0.1\bin\java.exe" -Xrs mz390 %1 @zcobol\opt\CBLOPT sysmac(%zcobol\mac+mac) syscpy(%zcobol\cpy) %2 %3 %4 %5 %6 %7 %8 %9 changed
"%PF%Java\jdk-17.0.1\bin\java.exe" -Xrs lz390 %1 SYSOBJ(+zcobol\z390) %2 %3 %4 %5 %6 %7 %8 %9 unchanged
"%PF%Java\jdk-17.0.1\bin\java.exe" -Xrs ez390 %1 SYS390(+zcobol\lib) %2 %3 %4 %5 %6 %7 %8 %9 changed
relevant changes were made
now retry BAT\ZC181C ZCOBOL\DEMO\CB001 in V181 most of previous errors gone away, but now objecting to other MACs. Try removing % from sysmac and syscopy
now retry BAT\ZC181C ZCOBOL\DEMO\CB001 in V181 now just MZ390E error 101 (1/3)3 missing copy = CB001_ZC_LABELS.CPY MZ390E error 266 (1/3)3 missing copy = CB001_ZC_LABELS.CPY AZ390E error 144 (40/56)295 ST ZC_R0,PP2_FILE+DCBDSNAM- IHADCB
Try adding +zcobol to syscpy in BAT\ZC181C in V181
now retry BAT\ZC181C ZCOBOL\DEMO\CB001 in V181 the same errors
should have been +zcobol\demo, change & retry just AZ390E error 144 (41/56)294 ST ZC_R0,PP2_FILE+DCBDSNAM-IHADCB still remains
error144 (no base register) was occurring and resisted many attempts to fix it by moving the code around in the program. it was finally fixed by moving the FD for the file involved from the sixth position to the 4th position.
now retry BAT\ZC181C ZCOBOL\DEMO\CB001 in V181 all the errors have gone away
change BAT\ZC181CL and BAT\ZC181CLG,
remove % from sysmac and syscpy and add +zcobol\demo to syscpy
Try running the rest of my test programs Some have been omitted because they pulled the same problems as under z390 Only those that encountered new problems are shown
BAT\ZC181C ZCOBOL\DEMO\CB002 in V181
AZ390E error 42 (42/285)2148 BRAS ZC_R14,3 SET ZC_R1 TO A(INLINE LIT) AND SKIP OVER IT
/*
* symbol table global variables
*/
byte sym_sdt = 0; // dec, b'', c'', h''
byte sym_cst = 1; // CSECT )alias REL)
byte sym_dst = 2; // DSECT (alias REL)
byte sym_ent = 3; // ENTRY (alias REL)
byte sym_ext = 4; // EXTRN external link
byte sym_rel = 5; // RX (CST.DST,ENT)_
byte sym_rld = 6; // complex rld exp
byte sym_lct = 7; // loctr (changed to cst/dst).
byte sym_wxt = 8; // WXTRN weak external link RPI182
byte sym_und = 9; // undefined symbol RPI 694
001050 (1/456)1268 *ZC 139 SUBTRACT 1,FROM,DDUB1,GIVING,BUB1 001050 F20090B8D05C 0000B8 00B1FC (44/44)1269+ PACK ZCVT_PWORK2(1),0+DDUB1(1) PACK #1 NORMAL 001056 F00090B80040 0000B8 (41/1504)1270+ SRP ZCVT_PWORK2(1),64-0,0 00105C F800D0B090B8 00B250 0000B8 (41/1506)1271+ ZAP BUB1,ZCVT_PWORK2(1) 001062 (42/285)1272+ BRAS ZC_R14,3 SET ZC_R1 TO A(INLINE LIT) AND SKIP OVER IT AZ390E error 42 (42/285)1272 BRAS ZC_R14,3 SET ZC_R1 TO A(INLINE LIT) AND SKIP OVER IT AZ390I 2 invalid rel off bits 16 exp_type=0 sym_rel=5
symrel=5; // RX (CST.DST,ENT) whilst exp_type=0=sdt, that is a self-defining term
relevant working-storage lines in ZCOBOL\DEMO\CB002.CBL in V181
01 DDUB1 PIC 9(01) value 1.
01 BUB1 PIC 9(01) COMP-3 value 0.
neither field signed. IBM COBOL doesn't seem to demand they be signed. doesn't get error under "z390" environment
compared z390\zcobol\demo\cb002.prn with v181\zcobol\demo\cb002.prn at the point of error 42, the assembler is the same.
Looked at the JAVA in AZ390.JAVA, the error 42 appears in new code in V181
Only occurs on a SUBTRACT GIVING where the receiving field is COMP-3
bat\zc181c zcobol\demo\cb031 AZ390E error 193 (43/2074)251 MVI 0(6,ZC_R3),C'0' AZ390I unexpected character before close ), There’s an error in az390 in the expectation of one addressing structure When another is being received,
expecting “( something )” getting “(6,”
')' in get_hex_lbddd and get_exp_abs_bddd and get_exp_abs_v2xbddd and get_exp_abs_xbddd
the 193 is in get_exp_abs_bddd
I suspect that get_exp_abs_xbddd may have the correct shape (the xbddd shape) to fit 0(6,zc_r3) Though I’m a complete novice in these areas
bat\zc181c zcobol\demo\cb037 MZ390E MNOTE 8,'GEN_PROC_END WS LENGTH ERROR= 4'
It was an error in GEN_PROC_END.MAC
AZ390E error 17 (44/213)424 BRUCE5 DC AL2(1234+) RPI 1065 when zcobol DISPLAYs a single COMP variable, either explicit positive sign or negative sign
bat\zc181c zcobol\demo\cb046 AZ390E error 98 (36/75)262 IILF ZC_R7,WSADDR9-WS characters ZC missing from beginning of WS in GEN_BASE.MAC
bat\zc181c zcobol\demo\cb063 AZ390E error 98 (42/75)612 IILF ZC_R7,RETURN_CODE-WS see above
bat\zc181c zcobol\demo\cb068 MZ390E MNOTE 8,'ZC_CALC MISSING VAR STACK PTR' I suspect that the error occurs with unary signs (+ or -) in a COMPUTE.
bat\zc181c zcobol\demo\cb070 MZ390E MNOTE 8,'ZC_CALC MISSING VAR STACK PTR' see above
bat\zc181c zcobol\demo\cb079 MZ390E MNOTE 8,'ZC_CALC MISSING VAR STACK PTR' see above
That completes the testing of my CBnnn.CBL test programs.
STARTING TESTING OF DB2 PORTING PROJECT
Ran DB2PREPY under v181 crash
You have to run BAT\DB2PREPY TESTALL2
The GEN_PROC_END problem that occurred in z390
Doesn’t occur in z181, so had to remove my fix from v181.
Re-ran BAT\DB2PREPY TESTALL2 in v181, the GEN_PROC_END problem Has gone away, but now objects about zc181c on testall2, need to change DB2PREPY.BAT again to prefix ZC181C with BAT.
Reran BAT\DB2PREPY TESTALL2 SQLCA.CPY is missing, so copy if into v181\zcobol\demo from z390\zcobol\demo But it’s called SQLCA.CPZ. Copied OK.
Reran BAT\DB2PREPY TESTALL2 Ran OK.
Now on to DB2PREPZ, so lets have a look at it. Added BAT\ as prefix and changed ZC390J toZC181CLG
Ran BAT\DB2PREPZ missing target program name, so BAT\DB2PREPZ TESTALL2 had to change CD C:\Z390 to CD C:\V181 BAT\DB2PREPZ TESTALL2,JH,TES2,CHOOKY
DB2PREPZ massaged, RUTE=C:\V181
The DB2PREPZ.CBL itself needs massage in respect of the generated CMD lines BAT\ prefix added twice and compiled OK.
Now we have to massage BAT\DB2CRE8.BAT , RUTE plus ZC181CLG
It ran to the end and I couldn’t see any errors, look at the generated CBLs
And they all look OK.
Now NUATEST.BAT massage it.
SQUELCH5 calls WREAD1 which uses SQL.BAT, it expects it to be under C:\Z390 but it’s getting written under C:\V181 – change BAT\NUATEST.BAT.
DB2PREPY TESTALL2 OK DB2PREPZ TESTALL2,JH,TES2,CHOOKY OK NUATEST TESTALL2,CHOOKY OK
DB2PREPY TESTALL3 OK DB2PREPZ TESTALL3,JH,TES2,CHOOKY OK NUATEST TESTALL3,CHOOKY OK
DB2PREPY TESTALL4 OK DB2PREPZ TESTALL4,JH,TES4,CHOOKY OK It generates 18 new CBLs NUATEST TESTALL4,CHOOKY S80A can’t cope
DB2PREPY TESTALL5 OK DB2PREPZ TESTALL5,JH,TES5,CHOOKY OK NUATEST TESTALL5,CHOOKY OK
DB2PREPY TESTALL6 OK DB2PREPZ TESTALL6,JH,TES6,CHOOKY OK NUATEST TESTALL6,CHOOKY Doesn’t like a SENSITIVE STATIC SCROLL CURSOR Same in z390
DB2PREPY TESTALL7 OK DB2PREPZ TESTALL7,JH,TES5,CHOOKY OK NUATEST TESTALL7,CHOOKY OK
DB2PREPY TESTALL8 OK DB2PREPZ TESTALL8,JH,TES8,CHOOKY OK NUATEST TESTALL8,CHOOKY OK
DB2PREPY TESTALL9 OK DB2PREPZ TESTALL9,JH,TES9,CHOOKY cannot cope with SQL command Same in z390 (an SQL WITH)
EMBEDDED SQL IN ZCOBOL PROGRAMS
This project provides Z390 with the ability to embed DB2 SQL in ZCOBOL programs.
Basically all we have to do to enable this is, to populate host variables in the SQL at runtime and to put back any retrieved DB2 data in the required host variables. And to provide the facility to run the SQL and retrieve the results.
IBM processes such programs thru a preprocessor turning SQL execs into calls to DB2API.DLL (which holds DLLs for all of the C programs used by their DB2).
We don’t support the type of call they use, so we have written our own preprocesser, that takes the target ZCOBOL program (like IBM, it has an extension of SQB) and massages it, so that it can run the SQL.
It comments out all the EXEC SQL thru END-EXEC constructs, storing the SQL in a file for later use.
And then it inserts code that does Dynamic Displays of any host variables that are needed for the SQL to run
It inserts code that calls a subroutine, for each SQL construct, which handles the SQL at runtime.
If the SQL is for a SELECT or a FETCH it inserts a call to a generated ZCOBOL sub-program that moves retrieved DB2 data into the host variable fields.
And finally, it inserts code for the call of the subroutine and closing of the DB2 environment before the “stop run” command.
AN EXAMPLE OF BEFORE AND AFTER PREPOCESSING
TESTALL6.SQB
IDENTIFICATION DIVISION. PROGRAM-ID. TESTALL6. *** AUTHOR-NAME. MICROFOCUS. ENVIRONMENT DIVISION. CONFIGURATION SECTION. SOURCE-COMPUTER. IBM-AT. OBJECT-COMPUTER. IBM-AT. INPUT-OUTPUT SECTION. FILE-CONTROL. DATA DIVISION. FILE SECTION. WORKING-STORAGE SECTION. 01 ID PIC X(06). 01 GIVEN PIC X(12). 01 INIT PIC X(01).
01 MI PIC X(01) VALUE 'K'.
01 GIVEN-IND PIC S9(04) COMP.
EXEC SQL
INCLUDE SQLCA
END-EXEC.
PROCEDURE DIVISION.
MOVE 0 TO SQLCODE.
EXEC SQL
DROP TABLE EMP
END-EXEC.
DISPLAY 'TESTALL6=drop===' SQLCODE.
MOVE 0 TO SQLCODE.
EXEC SQL
CREATE TABLE EMP(
EMPNO CHAR(06) NOT NULL,
FIRSTNME CHAR(12),
MIDINIT CHAR(01) NOT NULL,
PRIMARY KEY (EMPNO))
END-EXEC.
DISPLAY 'TESTALL6=create===' SQLCODE.
MOVE 0 TO SQLCODE.
EXEC SQL
INSERT INTO EMP( EMPNO, FIRSTNME, MIDINIT)
VALUES ('000005', 'JOHN ', 'C')
END-EXEC.
DISPLAY 'TESTALL6=insert===' SQLCODE.
MOVE 0 TO SQLCODE.
EXEC SQL
INSERT INTO EMP( EMPNO, FIRSTNME, MIDINIT)
VALUES ('000010', 'CHRISTINE ', 'K')
END-EXEC.
DISPLAY 'TESTALL6=insert===' SQLCODE.
MOVE 0 TO SQLCODE.
EXEC SQL
INSERT INTO EMP( EMPNO, FIRSTNME, MIDINIT)
VALUES ('000015', NULL , 'Z')
END-EXEC.
DISPLAY 'TESTALL6=insert===' SQLCODE.
MOVE 0 TO SQLCODE.
EXEC SQL
LOCK TABLE EMP IN EXCLUSIVE MODE
END-EXEC.
DISPLAY 'TESTALL6=lock===' SQLCODE.
MOVE 0 TO SQLCODE.
EXEC SQL
DECLARE C1 CURSOR FOR
SELECT *
FROM EMP
WHERE MIDINIT > :MI
FOR UPDATE OF FIRSTNME
END-EXEC.
DISPLAY 'TESTALL6=declare cursor===' SQLCODE.
MOVE 0 TO SQLCODE.
EXEC SQL
OPEN C1
END-EXEC.
DISPLAY 'TESTALL6=open cursor===' SQLCODE.
MOVE 0 TO SQLCODE.
EXEC SQL
FETCH C1
INTO :ID, :GIVEN:GIVEN-IND, :INIT
END-EXEC.
DISPLAY 'TESTALL6=fetch cursor===' SQLCODE.
IF SQLCODE = 0
DISPLAY 'TESTALL6==== ID ' ID
IF GIVEN-IND = -1
DISPLAY 'TESTALL6==== GIVEN IS NULL'
ELSE
DISPLAY 'TESTALL6==== GIVEN' GIVEN
END-IF
DISPLAY 'TESTALL6==== INIT ' INIT
END-IF.
MOVE 0 TO SQLCODE.
EXEC SQL
UPDATE EMP
SET FIRSTNME = 'FILLED'
WHERE CURRENT OF C1
END-EXEC.
DISPLAY 'TESTALL6=update where current of cursor==='
SQLCODE.
MOVE 0 TO SQLCODE.
EXEC SQL
SELECT *
INTO :ID, :GIVEN:GIVEN-IND, :INIT
FROM EMP
WHERE MIDINIT > :MI
END-EXEC.
DISPLAY 'TESTALL6=select===' SQLCODE.
IF SQLCODE = 0
DISPLAY 'TESTALL6==== ID ' ID
IF GIVEN-IND = -1
DISPLAY 'TESTALL6==== GIVEN IS NULL'
ELSE
DISPLAY 'TESTALL6==== GIVEN' GIVEN
END-IF
DISPLAY 'TESTALL6==== INIT ' INIT
END-IF.
MOVE 0 TO SQLCODE.
EXEC SQL
CLOSE C1
END-EXEC.
DISPLAY 'TESTALL6=close cursor===' SQLCODE.
THEND. STOP RUN.
TESTALL6.CBL
IDENTIFICATION DIVISION
PROGRAM-ID. TESTALL6.
*** AUTHOR-NAME. MICROFOCUS. ENVIRONMENT DIVISION. CONFIGURATION SECTION. SOURCE-COMPUTER. IBM-AT. OBJECT-COMPUTER. IBM-AT. INPUT-OUTPUT SECTION. FILE-CONTROL. DATA DIVISION. FILE SECTION. WORKING-STORAGE SECTION.
These are extra working-storage fields used by SQUELCH5 the preprocessor
WS 01 EYECATCHER PIC X(02). DB2PREPZ
WS 01 SQL-ID PIC X(06) VALUE SPACES. DB2PREPZ
01 ID PIC X(06).
01 GIVEN PIC X(12).
01 INIT PIC X(01).
01 MI PIC X(01) VALUE 'K'.
01 GIVEN-IND PIC S9(04) COMP.
The INCLUDE is changed to COPY
END-EXEC.
PROCEDURE DIVISION.
MOVE 0 TO SQLCODE.
The SQL is commented-out having been stored in a file SQL001 EXEC SQL SQL001 DROP TABLE EMP SQL001* END-EXEC.
Dynamic Displays have this format, if nothing is to be passed down ‘empty’ is used SQL001 DISPLAY 'DYNSTART empty' DB2PREPZ SQL001 DISPLAY 'DYNENDED empty' DB2PREPZ
The Sequence Id starts at SQL001 and is incremented by 1 for each new piece of SQL SQL001 MOVE 'SQL001' TO SQL-ID DB2PREPZ
SQL-IT calls the subroutine that resolves any host variable value substitution at runtime And runs the SQL SQL001 PERFORM SQL-IT THRU SQL-ITX DB2PREPZ
DISPLAY 'TESTALL6=drop===' SQLCODE.
MOVE 0 TO SQLCODE.
SQL002 EXEC SQL SQL002 CREATE TABLE EMP( SQL002 EMPNO CHAR(06) NOT NULL, SQL002 FIRSTNME CHAR(12), SQL002 MIDINIT CHAR(01) NOT NULL, SQL002 PRIMARY KEY (EMPNO)) SQL002* END-EXEC. SQL002 DISPLAY 'DYNSTART empty' DB2PREPZ SQL002 DISPLAY 'DYNENDED empty' DB2PREPZ SQL002 MOVE 'SQL002' TO SQL-ID DB2PREPZ SQL002 PERFORM SQL-IT THRU SQL-ITX DB2PREPZ DISPLAY 'TESTALL6=create===' SQLCODE.
MOVE 0 TO SQLCODE.
SQL003 EXEC SQL SQL003 INSERT INTO EMP( EMPNO, FIRSTNME, MIDINIT) SQL003 VALUES ('000005', 'JOHN ', 'C') SQL003 END-EXEC. SQL003 DISPLAY 'DYNSTART empty' DB2PREPZ SQL003 DISPLAY 'DYNENDED empty' DB2PREPZ SQL003 MOVE 'SQL003' TO SQL-ID DB2PREPZ SQL003 PERFORM SQL-IT THRU SQL-ITX DB2PREPZ DISPLAY 'TESTALL6=insert===' SQLCODE.
MOVE 0 TO SQLCODE.
SQL004 EXEC SQL SQL004 INSERT INTO EMP( EMPNO, FIRSTNME, MIDINIT) SQL004 VALUES ('000010', 'CHRISTINE ', 'K') SQL004 END-EXEC. SQL004 DISPLAY 'DYNSTART empty' DB2PREPZ SQL004 DISPLAY 'DYNENDED empty' DB2PREPZ SQL004 MOVE 'SQL004' TO SQL-ID DB2PREPZ SQL004 PERFORM SQL-IT THRU SQL-ITX DB2PREPZ DISPLAY 'TESTALL6=insert===' SQLCODE.
MOVE 0 TO SQLCODE.
SQL005 EXEC SQL SQL005 INSERT INTO EMP( EMPNO, FIRSTNME, MIDINIT) SQL005 VALUES ('000015', NULL , 'Z') SQL005 END-EXEC. SQL005 DISPLAY 'DYNSTART empty' DB2PREPZ SQL005 DISPLAY 'DYNENDED empty' DB2PREPZ SQL005 MOVE 'SQL005' TO SQL-ID DB2PREPZ SQL005 PERFORM SQL-IT THRU SQL-ITX DB2PREPZ DISPLAY 'TESTALL6=insert===' SQLCODE.
MOVE 0 TO SQLCODE.
SQL006 EXEC SQL SQL006 LOCK TABLE EMP IN EXCLUSIVE MODE SQL006* END-EXEC. SQL006 DISPLAY 'DYNSTART empty' DB2PREPZ SQL006 DISPLAY 'DYNENDED empty' DB2PREPZ SQL006 MOVE 'SQL006' TO SQL-ID DB2PREPZ SQL006 PERFORM SQL-IT THRU SQL-ITX DB2PREPZ DISPLAY 'TESTALL6=lock===' SQLCODE.
MOVE 0 TO SQLCODE.
SQL007 EXEC SQL SQL007 DECLARE C1 CURSOR FOR SQL007 SELECT SQL007 FROM EMP SQL007 WHERE MIDINIT > :MI SQL007 FOR UPDATE OF FIRSTNME SQL007 END-EXEC.
The SQL uses the host variable :MI, so MI is Dynamically Displayed SQL007 DISPLAY 'DYNSTART' MI DB2PREPZ SQL007 DISPLAY 'DYNENDED empty' DB2PREPZ
SQL007 MOVE 'SQL007' TO SQL-ID DB2PREPZ SQL007 PERFORM SQL-IT THRU SQL-ITX DB2PREPZ DISPLAY 'TESTALL6=declare cursor===' SQLCODE.
MOVE 0 TO SQLCODE.
SQL008 EXEC SQL SQL008 OPEN C1 SQL008* END-EXEC. SQL008 DISPLAY 'DYNSTART empty' DB2PREPZ SQL008 DISPLAY 'DYNENDED empty' DB2PREPZ SQL008 MOVE 'SQL008' TO SQL-ID DB2PREPZ SQL008 PERFORM SQL-IT THRU SQL-ITX DB2PREPZ DISPLAY 'TESTALL6=open cursor===' SQLCODE.
MOVE 0 TO SQLCODE.
SQL009 EXEC SQL SQL009 FETCH C1 SQL009 INTO :ID, :GIVEN:GIVEN-IND, :INIT SQL009 END-EXEC. SQL009 DISPLAY 'DYNSTART empty' DB2PREPZ SQL009 DISPLAY 'DYNENDED empty' DB2PREPZ SQL009 MOVE 'SQL009' TO SQL-ID DB2PREPZ SQL009 PERFORM SQL-IT THRU SQL-ITX DB2PREPZ
The generated program is only called if the SQL was successful IF SQLCODE NOT < 0 AND SQLCODE NOT = +100
This program is generated by DB2CRE8 via DB2PREPZ and puts DB2 values into the host variables SQL009 CALL 'JHTES609' USING DB2PREPZ
The host variables which follow are those in the SQL above in the INTO clause including an indicator variable because the ‘given' field can be nullable SQL009 ID , DB2PREPZ SQL009 GIVEN , DB2PREPZ SQL009 GIVEN-IND , DB2PREPZ SQL009 INIT DB2PREPZ
END-IF
DISPLAY 'TESTALL6=fetch cursor===' SQLCODE.
IF SQLCODE = 0
DISPLAY 'TESTALL6==== ID ' ID
IF GIVEN-IND = -1
DISPLAY 'TESTALL6==== GIVEN IS NULL'
ELSE
DISPLAY 'TESTALL6==== GIVEN' GIVEN
END-IF
DISPLAY 'TESTALL6==== INIT ' INIT
END-IF.
MOVE 0 TO SQLCODE.
SQL010 EXEC SQL SQL010 UPDATE EMP SQL010 SET FIRSTNME = 'FILLED' SQL010 WHERE CURRENT OF C1 SQL010* END-EXEC. SQL010 DISPLAY 'DYNSTART empty' DB2PREPZ SQL010 DISPLAY 'DYNENDED empty' DB2PREPZ SQL010 MOVE 'SQL010' TO SQL-ID DB2PREPZ SQL010 PERFORM SQL-IT THRU SQL-ITX DB2PREPZ DISPLAY 'TESTALL6=update where current of cursor===' SQLCODE.
MOVE 0 TO SQLCODE.
SQL011 EXEC SQL SQL011 SELECT SQL011 INTO :ID, :GIVEN:GIVEN-IND, :INIT SQL011 FROM EMP SQL011 WHERE MIDINIT > :MI SQL011* END-EXEC. SQL011 DISPLAY 'DYNSTART' MI DB2PREPZ SQL011 DISPLAY 'DYNENDED empty' DB2PREPZ SQL011 MOVE 'SQL011' TO SQL-ID DB2PREPZ SQL011 PERFORM SQL-IT THRU SQL-ITX DB2PREPZ
IF SQLCODE NOT < 0
AND SQLCODE NOT = +100
SQL011 CALL 'JHTES611' USING DB2PREPZ SQL011 ID , DB2PREPZ SQL011 GIVEN , DB2PREPZ SQL011 GIVEN-IND , DB2PREPZ SQL011 INIT DB2PREPZ
END-IF
DISPLAY 'TESTALL6=select===' SQLCODE.
IF SQLCODE = 0
DISPLAY 'TESTALL6==== ID ' ID
IF GIVEN-IND = -1
DISPLAY 'TESTALL6==== GIVEN IS NULL'
ELSE
DISPLAY 'TESTALL6==== GIVEN' GIVEN
END-IF
DISPLAY 'TESTALL6==== INIT ' INIT
END-IF.
MOVE 0 TO SQLCODE.
SQL012 EXEC SQL SQL012 CLOSE C1 SQL012* END-EXEC. SQL012 DISPLAY 'DYNSTART empty' DB2PREPZ SQL012 DISPLAY 'DYNENDED empty' DB2PREPZ SQL012 MOVE 'SQL012' TO SQL-ID DB2PREPZ SQL012 PERFORM SQL-IT THRU SQL-ITX DB2PREPZ DISPLAY 'TESTALL6=close cursor===' SQLCODE.
THEND.
The DB2 needs to be finished off before the STOP RUN SQLZZZ MOVE 'FINIS' TO SQL-ID. DB2PREPZ SQLZZZ PERFORM SQL-IT THRU SQL-ITX. DB2PREPZ
STOP RUN.
Here we include the paragraph that CALLs the subroutine SQLZZZ SQL-IT. DB2PREPZ SQLZZZ CALL 'SQUELCH5' USING SQL-ID, SQLCA, DB2PREPZ SQLZZZ EYECATCHER. DB2PREPZ SQLZZZ SQL-ITX. EXIT. DB2PREPZ
Running the BATch files
JHJAVC.BAT
jhjavc src/sz390
And it’s preferable if you compile ez390, too.
ZC390CLJ.BAT
zc390clj zcobol\demo\progname
DB2PREPY.BAT
db2prepy SQB-program-name
This could be
db2prepy testall2
DB2PREPZ.BAT
db2prepz SQB-program-name.ii.pppp,database-name
where ii are your initials
and pppp is the abbreviated program name
This could be
db2prepz testall2,jh,tes2,chooky
DB2CRE8.BAT
db2cre8 ii,pppp,ss,CBL-program-name
where ii are your initials pppp is the abbreviated program name and ss are the last two digits of the sequence id.
This could be db2cre8 jh,tes2,03,chooky
The call of this BAT is done by DB2PREPZ, So you don’t have to be concerned by this BAT
NUATEST.BAT
nuatest CBL-program-name,database-name
This could be nuatest testall2,chooky
SETUPEMP.BAT
setupemp
SETDB2DA,BAT
setdb2da
Deliverables
My directory structure is
C:
\Z390 BAT files
\ZCOBOL MAC files
\DEMO ZCOBOL progs
SQB progs
MLC progs
\Z390 ZC390CLG.OPT
has NOTIME added
\SRC JAVA progs
WS.MAC
It has been changed to additionally output the details of each Working-Storage field to the ERR file.
MACs are not compiled
SZ390.JAVA
It has been changed to allow ZCOBOL to do dynamic displays, whereby the unpacked value of displayed fields are written to a file (Z390\DISPLAY.TXT),
It is compiled with JHJAVC
DB2PREPY.CBL & DB2PREPZ.CBL
They are used to customise the target program which has the embedded SQL.
They are compiled with ZC390C
DB2CRE8.CBL
Used by DB2PREPZ to generate ZCOBOL sub-programs to put back DB2 column values into host variables.
It is compiled with ZC390C
SQUELCH5.CBL
SQUELCH5 is the SQL Command Handler for embedded DB2 SQL ZCOBOL programs
It is compiled with ZC390C
START1/WREAD1/STOP1 START2/WREAD2/STOP2 START3/WREAD3/STOP3 These are MLC files
Modified CMDPROC
They are compiled with ZCASM
JHTES2YY.CBL
Is the prototype CBL file that is used by DB2CRE8 to generate ZCOBOL files, one for each of the SQLs that does a SELECT or FETCH.
CRE8BIN.BIN
Is a prototype BAT file that is used by DB2PREPZ to generate a BAT file that’ll run the DB2CRE8 for that SELECT/FETCH.
JHJAVC.BAT
Compiles JAVA
ZC390CLJ.BAT
Compiles and links ZCOBOL program then runs my ez390.
DB2PREPY.BAT DB2PREPZ.BAT DB2CRE8.BAT NUATEST.BAT SETUPEMP.BAT SETDB2DA,BAT TESTALL2.SQB TESTALL3.SQB TESTALL4.SQB TESTALL5.SQB TESTALL6.SQB TESTALL7.SQB TESTALL8.SQB
APPENDIX
For DB2, I use the free IBM DB2 Community Edition.
And I use the “DB2 Command Window – Administrator”
For JAVA, I use Oracle jdk-17_windows-x64_bin
The following code was inserted in WS.MAC
. mnote 0,'WS_START================================'
. mnote 0,'WS name===== &SYM_NAME(&SYM_TOT)'
. mnote 0,'WS lvl====== &SYM_LVL(&SYM_TOT)'
. mnote 0,'WS loc====== &SYM_LOC(&SYM_TOT)'
. mnote 0,'WS len====== &SYM_LEN(&SYM_TOT)'
. mnote 0,'WS pic====== &SYM_PIC(&SYM_TOT)'
. mnote 0,'WS pic_type= &SYM_PIC_TYPE(&SYM_TOT)'
. mnote 0,'WS pic_sign= &SYM_PIC_SIGN(&SYM_TOT)'
. mnote 0,'WS pic_dec== &SYM_PIC_DEC(&SYM_TOT)'
. mnote 0,'WS_END=================================='
:&d1 setc '&SYM_NAME(&SYM_TOT)'
:&d2 setc '&SYM_LVL(&SYM_TOT)'
:&d3 setc '&SYM_LOC(&SYM_TOT)'
:&d4 setc '&SYM_LEN(&SYM_TOT)'
:&d5 setc '&SYM_PIC(&SYM_TOT)'
:&d6 setc '&SYM_PIC_TYPE(&SYM_TOT)'
:&d7 setc '&SYM_PIC_SIGN(&SYM_TOT)'
:&d8 setc '&SYM_PIC_DEC(&SYM_TOT)'
mnote 0,'workstor &d1 &d2 &d3 &d4 &d5 &d6 &d7 &d8'
The following code in SZ390.JAVA was changed
private void put_log_line(String msg){ /*
put line to listing file */ // System.out.println("sz390 put_log_line ***"); if (tz390.opt_list){ if (log_file.canWrite()){ // RPI 661 try { tz390.systerm_io++; log_file_buff.write(msg + tz390.newline); // RPI 500 if (log_file.length() > tz390.max_file_size){ abort_error(107,"maximum log file size exceeded"); } } catch (Exception e){ tz390.abort_error(6,"I/O error on log file write msg - " + msg); // RPI 661 } } else { put_con(msg); } } put_disp(msg); // added by jclh } private void put_con(String msg) { /
and yield to let parent process m
*/
if (!tz390.force_nocon)
{ // RPI 1050 for future use
System.out.println(msg);
Thread.yield();
}
}
public void put_disp(String msg) // whole method added by jclh
{
// System.out.println("sz390 put_disp");
{
try
{
if (msg.contains("DYNSTART"))
{
System.out.println("sz390 put_disp DYNSTART;");
tz390.myWriter = new FileWriter("c:\z390\display.txt");
System.out.println("sz390 put_disp DYNSTART - after open;");
put_disp_line(msg);
System.out.println("sz390 put_disp DYNSTART - after put_disp_line;");
}
}
catch (Exception e)
{
abort_error(990,"I/O error on display file open - " + e.toString());
}
}
{
try
{
if ((msg.contains("DYN")) && !(msg.contains("START")))
{
System.out.println("sz390 put_disp DYN & !START;");
put_disp_line(msg);
}
}
catch (Exception e)
{
abort_error(991,"I/O error on display file line - " + e.toString());
}
}
}
public void put_disp_line(String msg) // whole method added by jclh
{
System.out.println("sz390 entering put_disp_line DYNSTART;");
System.out.println("****sz390 put_disp_line DYNSTART;" + msg.length() + msg);
if (msg.length() < 11) { jclh = ""; } else { jclh = msg.substring(10); }
System.out.println("****sz390 put_disp_line DYNSTART -;" + jclh);
System.out.println("****sz390 after jclh in put_disp_line DYNSTART;");
System.out.println("sz390 put_disp_line;");
System.out.println("sz390 put_disp_line+" + msg + ";");
{
if (msg.contains("START"))
{
System.out.println("sz390 put_disp_line START;");
try
{
System.out.println("sz390 put_disp_line START write;");
tz390.myWriter.write(jclh + tz390.newline);
}
catch (Exception e)
{
abort_error(992,"I/O error on display file write - " + e.toString());
}
}
if (!msg.contains("START"))
{
System.out.println("sz390 put_disp_line !START;");
try
{
System.out.println("sz390 put_disp_line !START write;");
tz390.myWriter.write(jclh + tz390.newline);
}
catch (Exception e)
{
abort_error(993,"I/O error on display file write - " + e.toString());
}
}
if (msg.contains("ENDED"))
{
System.out.println("sz390 put_disp_line ENDED;");
try
{
System.out.println("sz390 put_disp_line END close;");
tz390.myWriter.close();
}
catch (Exception e)
{
abort_error(994,"I/O error on display file close - " + e.toString());
}
}
}
}
ZC390CLJ.BAT
rem ZC390CLJ translate CBL to MLC, assemble/link to 390 via z390, and exec my ez390
echo OFF if %1 == tron ECHO ON if %1 == tron shift if %1 == TRON ECHO ON if %1 == TRON shift if exist %1.CBL goto erase echo on pause no zcobol program found %1.CBL goto end
:erase
if exist %1.MLC erase %1.MLC
if exist %1.390 erase %1.390
if exist %1.BAL erase %1.BAL
if exist %1.ERR erase %1.ERR
if exist %1.LST erase %1.LST
if exist %1.OBJ erase %1.OBJ
if exist %1.PRN erase %1.PRN
if exist %1.STA erase %1.STA
if exist %1.390 erase %1.390
REM if exist %1.TR? erase %1.TR?
if exist %1.cpp erase %1.cpp
if exist %1.java erase %1.java
if exist %1.class erase %1.class
set classpath=src set PF=C:\Program Files\
call %~dps0ZC390 %1 SYSCPY(+zcobol+zcobol\z390) %2 %3 %4 %5 %6 %7 %8 %9 if errorlevel 5 goto mzerr
call %~dps0MZ390 %1 @zcobol\z390\ZC390CLG %2 %3 %4 %5 %6 %7 %8 %9 if errorlevel 5 goto mzerr
call %~dps0LZ390 %1 SYSOBJ(+zcobol\z390) %2 %3 %4 %5 %6 %7 %8 %9 if errorlevel 5 goto lzerr
REM echo "%PF%Java\jdk1.8.0\bin\java.exe" REM "%PF%Java\jdk1.8.0_181\bin\java.exe" -Xrs ez390 %1 @zcobol\z390\zc390clg > zc390clj.log
REM echo "%PF%Java\jdk-17.0.1\bin\java.exe"
"%PF%Java\jdk-17.0.1\bin\java.exe" -Xrs ez390 %1 @zcobol\z390\zc390clg
if errorlevel 1 goto ezerr goto end :mzerr pause see errors on mz390 generated bal file and console goto end :lzerr pause see errors on lz390 generated lst file and console erase %1.390 goto end :ezerr pause see errors on ez390 generated log file and console :end
DB2PREPY.BAT
ECHO ON REM DB2PREPY Comments out SQL of target zcobol program REM and compiles it to get workstor fields in ERR file REM
SET INFILE=%1.SQB SET OUTFILE=%1.CBL
call ZC390CLG ZCOBOL\DEMO\DB2PREPY NOTIME if errorlevel 1 GOTO DB2PREPY_ERROR GOTO NEXTPART
:DB2PREPY_ERROR ECHO ON ECHO DB2PREPY BOMBED GOTO THEND
:NEXTPART call ZC390C %1 if errorlevel 1 GOTO RONG GOTO THEND
:RONG ECHO ON ECHO COMPILE OF %1 BOMBED GOTO THEND
:THEND
DB2PREPZ.BAT
ECHO ON REM DB2PREPZ Converts an Embedded SQL zcobol program REM and runs it REM
cd c:\z390
SET COBDIR=ZCOBOL\DEMO\
set DB2INSTANCE=MYINST1 db2clpsetcp
ECHO CONNECT TO CHOOKY~ > SQL.BAT call db2 -vac -td~ -f SQL.BAT
ERASE SQL.BAT
REM DB2 OPTIONS REM -v This option tells the command line processor to echo REM command text to standard output. REM -a This option tells the command line processor to display REM SQLCA data. REM -c This option tells the command line processor to REM automatically commit SQL statements. REM -td~ This option tells the command line processor to define REM and to use ~ as the statement termination character REM -f This option tells the command line processor to read REM command input from a file instead of from standard input. REM -z This option tells the command line processor to redirect REM all output to a file. It is similar to the -r option, REM but includes any messages or error codes with the output. REM -e{c|s} This option tells the command line processor to display REM SQLCODE or SQLSTATE. These options are mutually exclusive REM -x This option tells the command line processor to return data REM without any headers, including column names. REM ECHO TYPE C:\Z390\%COBDIR%%1.SQI > SQL.BAT ECHO ERASE C:\Z390\SQL.RES >> SQL.BAT set string1=call db2 -va -ec -x -td~ -f c:\z390\%COBDIR%%1 set string2=.sqi -z C:\Z390\SQL.RES ECHO %string1%%string2% >> SQL.BAT ECHO REM END >> SQL.BAT
TYPE SQL.BAT
ECHO %1 > TARGET.OUT SET CRE8TARG=TARGET.OUT ECHO %2 > INITS.OUT SET CRE8INTS=INITS.OUT ECHO %3 > PID.OUT SET CRE8PID=PID.OUT
SET ERRFILE=%COBDIR%%1.ERR SET SQLFILE=%COBDIR%%1.SQL SET SQLSTMT=SQL.BAT SET SQLIN=%COBDIR%%1.SQI SET SQLRES=SQL.RES REM 221122 KAZAK SET ANOFILE=ANO.OUT
SET INFILE=%COBDIR%%1.SQB SET OUTFILE=%COBDIR%%1.CBL
SET CRE7BIN=CRE7BIN.BIN SET CRE7SQL3=SQL3.BAT
call ZC390CLJ %COBDIR%DB2PREPZ,NOTIME ECHO the errorlevel was %errorlevel% if errorlevel 1 GOTO DB2PREPZ_ERROR GOTO NEXTPART
:DB2PREPZ_ERROR ECHO ON ECHO DB2PREPZ BOMBED GOTO THEND
:NEXTPART
ECHO CONNECT RESET~ > sql.bat call db2 -vac -td~ -f SQL.BAT
ECHO TERMINATE~ > sql.bat call db2 -vac -td~ -f SQL.BAT
ECHO QUIT~ > sql.bat call db2 -a -td~ -f SQL.BAT
ERASE SQL.BAT
ECHO ON
:THEND EXIT /B
cmd /c exit -1073741510 Y EXIT /B
DB2CRE8.BAT
ECHO OFF REM DB2CRE8.BAT is run via DB2CRE7.BAT
ECHO %1 ECHO %2 ECHO %3 ECHO %4
cd c:\z390
SET COBDIR=ZCOBOL\DEMO\
ECHO %1 > INITS.OUT SET CRE8INTS=INITS.OUT ECHO %2 > PID.OUT SET CRE8PID=PID.OUT ECHO %3 > SEQ.OUT SET CRE8SEQ=SEQ.OUT
SET CRE8IN=c:\z390\%COBDIR%JHTES2YY.CBL SET CRE8IN2=c:\z390\%COBDIR%%4.sqb ECHO %1%2%3 SET CRE8OUT=c:\z390\%COBDIR%%1%2%3.CBL SET CRE8ANO=ANO.OUT
call ZC390CLJ %COBDIR%DB2CRE8,NOTIME,NOTIMING REM END
NUATEST.BAT
ECHO ON REM NUATEST - runs TESTALLx REM
SET DB2INSTANCE=MYINST1 DB2CLPSETCP
ECHO CONNECT TO CHOOKY~ > sql.bat call db2 -vac -td~ -f SQL.BAT
REM DB2 OPTIONS REM -v This option tells the command line processor to echo REM command text to standard output. REM -a This option tells the command line processor to display REM SQLCA data. REM -c This option tells the command line processor to REM automatically commit SQL statements. REM -td~ This option tells the command line processor to define REM and to use ~ as the statement termination character REM -f This option tells the command line processor to read REM command input from a file instead of from standard input. REM -z This option tells the command line processor to redirect REM all output to a file. It is similar to the -r option, REM but includes any messages or error codes with the output. REM -e{c|s} This option tells the command line processor to display REM SQLCODE or SQLSTATE. These options are mutually exclusive REM -x This option tells the command line processor to return data REM without any headers, including column names. REM REM ECHO TYPE C:\Z390\%1.SQI > SQL.BAT ECHO ERASE C:\Z390\SQL.RES > SQL.BAT set string1=call db2 -va -ec -td~ -f c:\z390\%1 set string2=.sqi -z C:\Z390\SQL.RES ECHO %string1%%string2% >> SQL.BAT ECHO COPY SQL.RES SQL.CPY >> SQL.BAT ECHO REM END >> SQL.BAT
rem REM THE SECOND DEL IS TO GET A MSG FROM THE OS TO SAY rem REM THAT THE FILE CANNOT BE FOUND
REM ECHO DEL C:\Z390\DISPLAY.TXT > SQL2.BAT REM ECHO DEL C:\Z390\DISPLAY.TXT >> SQL2.BAT REM ECHO REM END >> SQL2.BAT
SET ERRFILE=C:\Z390\ZCOBOL\DEMO\%1.ERR SET SQLFILE=C:\Z390\ZCOBOL\DEMO\%1.SQL SET SQLSTMT=C:\Z390\SQL.BAT REM SET DOSCMD2=C:\Z390\SQL2.BAT SET SQLIN=C:\Z390\%1.SQI SET SQLRES=SQL.RES SET SQLCPY=SQL.CPY SET DISPFILE=C:\Z390\DISPLAY.TXT
CD C:\Z390
call ZC390CLJ ZCOBOL\DEMO\%1
if errorlevel 1 GOTO RUNIT_ERROR
GOTO THEND
:RUNIT_ERROR ECHO ON ECHO NUATEST BOMBED GOTO THEND
:THEND ECHO ON ECHO THEND
SETUPEMP.BAT
Set up some test data
ECHO OFF REM SETUPEMP sets up table EMP in CHOOKY REM
ECHO ON set DB2INSTANCE=MYINST1 db2clpsetcp
ECHO CONNECT TO CHOOKY~ > SQL.BAT call db2 -vac -td~ -f SQL.BAT
ECHO DROP TABLE EMP~ > SQL.BAT call db2 -vac -td~ -f SQL.BAT
ECHO CREATE TABLE EMP( > SQL.BAT ECHO EMPNO CHAR(06) NOT NULL, >> SQL.BAT ECHO FIRSTNME CHAR(12), >> SQL.BAT ECHO MIDINIT CHAR(01) NOT NULL, >> SQL.BAT ECHO PRIMARY KEY (EMPNO))~ >> SQL.BAT call db2 -vac -td~ -f SQL.BAT
ECHO INSERT INTO EMPL (empno, firstnme, midinit) VALUES ('000005', 'JOHN ', 'C')~ > sql.bat call db2 -vac -td~ -f SQL.BAT
ECHO INSERT INTO EMP (empno, firstnme, midinit) VALUES ('000010', 'CHRISTINE ', 'K')~ > sql.bat call db2 -vac -td~ -f SQL.BAT
ECHO INSERT INTO EMP (empno, midinit) VALUES ('000015', 'Z')~ > sql.bat call db2 -vac -td~ -f SQL.BAT
ECHO SELECT * FROM EMP~ > sql.bat call db2 -vac -td~ -f SQL.BAT
ECHO CONNECT RESET~ > sql.bat call db2 -vac -td~ -f SQL.BAT
ECHO TERMINATE~ > sql.bat call db2 -vac -td~ -f SQL.BAT
ECHO QUIT~ > sql.bat call db2 -a -td~ -f SQL.BAT
:THEND ECHO ON ECHO THEND
SETDB2DA,BAT
Set up test data with all DB2 datatypes we support
ECHO OFF
REM DB2DATA sets up table DB2DATA in CHOOKY
REM that houses all the data types
REM that I'll support in my version
REM of ZCOBOL Embedded DB2.
REM It'll DESCRIBE that table to ensure
REM fields have the correct data type.
REM Those fields will be populated.
REM (There'll be 2 rows INSERTed.
REM one - with all non-NULL data,
REM two - with non-NULL data in even data types
REM and with NULLs in odd data types)
REM Finally 2 SELECTs will be written
REM (one - that'll retrieve 2 rows of
REM even data types, two - that'll retrieve
REM 2 rows of odd data types)
REM that will extract those fields in HEX
REM that'll fit within ZCOBOL fields.
REM
REM
REM Data types 456 and 457 (long varchar) REMoved
REM
REM Data types 384/385(date), 388/389(time), 392/393(timestamp)
REM are to be treated as CHARacter fields
REM
REM Data types 448/449(varchar) are headed by a 2 byte length field
REM whose bytes are the reverse order of zcobol COMP fields,
REM the remainder are to be treated as CHARacter bytes
REM
REM Data types 452/453(char) are to be treated as CHARacter fields
REM
REM Data types 484/485(decimal), 492/493(bigint), 496/497(integer),
REM 500/501(smallint) will be represented by HEX pairs
REM
REM Arbitrary lengths have been chosen for varchar fields of 256 bytes
REM Arbitrary lengths have been chosen for char fields of 32 bytes
REM Arbitrary precision and scale have been chosen for decimal fields
REM of 9 and 2
REM
ECHO ON set DB2INSTANCE=MYINST1 db2clpsetcp
ECHO 01 ECHO CONNECT TO CHOOKY~ > SQL.BAT call db2 -vac -td~ -f SQL.BAT
ECHO 02 ECHO DROP TABLE DB2DATA~ > SQL.BAT call db2 -vac -td~ -f SQL.BAT
ECHO 03 ECHO CREATE TABLE DB2DATA( > SQL.BAT ECHO FIELD384 DATE NOT NULL, >> SQL.BAT ECHO FIELD385 DATE DEFAULT NULL, >> SQL.BAT ECHO FIELD388 TIME NOT NULL, >> SQL.BAT ECHO FIELD389 TIME DEFAULT NULL, >> SQL.BAT ECHO FIELD392 TIMESTAMP NOT NULL, >> SQL.BAT ECHO FIELD393 TIMESTAMP DEFAULT NULL, >> SQL.BAT ECHO FIELD448 VARCHAR(256) NOT NULL, >> SQL.BAT ECHO FIELD449 VARCHAR(256), >> SQL.BAT ECHO FIELD452 CHAR(255) NOT NULL, >> SQL.BAT ECHO FIELD453 CHAR(255), >> SQL.BAT ECHO FIELD484 DECIMAL(9,2) NOT NULL, >> SQL.BAT ECHO FIELD485 DECIMAL(9,2), >> SQL.BAT ECHO FIELD492 BIGINT NOT NULL, >> SQL.BAT ECHO FIELD493 BIGINT, >> SQL.BAT ECHO FIELD496 INTEGER NOT NULL, >> SQL.BAT ECHO FIELD497 INTEGER, >> SQL.BAT ECHO FIELD500 SMALLINT NOT NULL, >> SQL.BAT ECHO FIELD501 SMALLINT)~ >> SQL.BAT call db2 -vac -td~ -f SQL.BAT
ECHO 04 ECHO INSERT INTO DB2DATA( > SQL.BAT ECHO FIELD384, >> SQL.BAT ECHO FIELD385, >> SQL.BAT ECHO FIELD388, >> SQL.BAT ECHO FIELD389, >> SQL.BAT ECHO FIELD392, >> SQL.BAT ECHO FIELD393, >> SQL.BAT ECHO FIELD448, >> SQL.BAT ECHO FIELD449, >> SQL.BAT ECHO FIELD452, >> SQL.BAT ECHO FIELD453, >> SQL.BAT ECHO FIELD484, >> SQL.BAT ECHO FIELD485, >> SQL.BAT ECHO FIELD492, >> SQL.BAT ECHO FIELD493, >> SQL.BAT ECHO FIELD496, >> SQL.BAT ECHO FIELD497, >> SQL.BAT ECHO FIELD500, >> SQL.BAT ECHO FIELD501 >> SQL.BAT ECHO ) >> SQL.BAT ECHO VALUES ( >> SQL.BAT ECHO '2022-03-14', >> SQL.BAT ECHO NULL, >> SQL.BAT ECHO '01:02:03', >> SQL.BAT ECHO NULL, >> SQL.BAT ECHO CURRENT TIMESTAMP, >> SQL.BAT ECHO NULL, >> SQL.BAT ECHO 'ABCDEFG', >> SQL.BAT ECHO NULL, >> SQL.BAT ECHO 'THIS IS A FIXED LENGTH STRING 32', >> SQL.BAT ECHO NULL, >> SQL.BAT REM ECHO 'A VERY LONG VARIABLE FIELD', >> SQL.BAT REM ECHO 'THIS IS A VERY LONG VARIABLE FIELD', >> SQL.BAT ECHO -0000001.23, >> SQL.BAT ECHO NULL, >> SQL.BAT ECHO -000000000000000123, >> SQL.BAT ECHO NULL, >> SQL.BAT ECHO -000000123, >> SQL.BAT ECHO NULL, >> SQL.BAT ECHO -0123, >> SQL.BAT ECHO NULL >> SQL.BAT ECHO )~ >> sql.bat call db2 -vac -td~ -f SQL.BAT
ECHO SELECT * FROM DB2DATA~ > sql.bat call db2 -vac -td~ -f SQL.BAT > SQL.RES
ECHO 12 ECHO CONNECT RESET~ > sql.bat call db2 -vac -td~ -f SQL.BAT
ECHO 13 ECHO TERMINATE~ > sql.bat call db2 -vac -td~ -f SQL.BAT
ECHO 14 ECHO QUIT~ > sql.bat call db2 -a -td~ -f SQL.BAT
:THEND ECHO ON ECHO THEND SQUELCH5 takes embedded SQL commands from the calling ZCOBOL program and converts them for use by DB2 CLP (Command Line Processor).
Basically it comments-out the "INTO" clause from SELECT INTO and FETCH INTO commands.
It also replaces remaining host variables (those starting :) in all SQL statements with the actual values from the calling program, at run time.
During compilation of the target program, all Working Storage fields, have their details stored in the ERR file, using a modified WS.MAC routine.
SQL commands are run within DB2 CLP by submission thru modified CMDPROC assembler.
start1/wread1/stop1,
start1 being run once, initially,
wread1 is invoked each time an SQL command is to be processed,
(It submits the SQL request, as a DB2 batch command, and reads any subsequent
output.)
stop1 being run once, after all SQL has been processed.
Connection to the DB2 database is retained between separate invocations of wread1.
SQUELCH5 should be able to support all SQL commands that CLP supports.
A commit will be effected when the DB2 CONNECT RESET is processed.
GENERATED ZCOBOL PROGRAMS
Are generated by DB2CRE8 and have the naming format of IIPPPPSS where II are your initials, so mine are JH and PPPP is an abbreviated target program id, thus TESTALL2 might be abbreviated to TES2, and SS is the last 2 digits of the sequence number of that SELECT/FETCH in the target program, e.g. 03. ADDITIONAL INFORMATION
ADDING DB2 LICENSE
DB2LICM -A C:\USERS\USER\DESKTOP.LICBKUP\LIC00000001.LIC
DECLARE CURSOR FOR UPDATE
If you want to do an update where current of cursor, you have to ensure that you don't auto-commit (switch off -c as in "call db2 +bc -va -td~ -f SQL.BAT, if you don't and subsequently try to update it, it will get an sqlcode of -508.
DATA TYPES ON A DESCRIBE
If they are odd, they have an indicator variable
SQL
EXEC SQL and END-EXEC should be capitalized and occur on lines by themselves.
DECLARE CURSOR statements should appear in the Procedure Division, DB2PREPZ will add "WITH HOLD" to ensure we won't lose the cursor positioning should a comit occur.
All host variables ought to be in capital letters.
The maximum length we can define a VARCHAR field with, when we CREATE a TABLE is 32,672, not 32,768 as expected.
you can't use HEX on a VARCHAR field, you have to make it a CHAR first
DB2 COMMAND WINDOW
After DB2 has been installed, you can access the command window
via START button, LEFT CLICK
IBM DB2 DBCOPY1 (Default), LEFT CLICK
DB2 Command Window – Administrator, LEFT CLICK
And YES LEFT CLICK
USING DB2 VIA COMMAND WINDOW
CD C:\Z390
DB2LICM –A C:\USERS\USER\DESKTOP\.LICBKUP\LIC00000001.LIC
Adds a license for a product.
DB2LICM –L Lists all the products with available license information, including the product identifier.
DB2LICM –V Displays version information.
DB2LICM -? Displays help information for DB2LICM
Because you are in a DB2 Command Window, you don’t have to start the database manager.
DB2 ? Is the help for DB2. It shows you how to get further help.
DB2 CREATE DATABASE DONH It takes a while.Don’t freak. Dum, dee. Dum.There it’s done.
DB2 CONNECT TO DONH Connect to the database you just created.
DB2 CREATE TABLE ASIMPLE1 (COLUMN1 CHAR(06)) Create a table, a simple one.
DB2 SELECT * FROM ASIMPLE1 It found your table but there’s nothing in it
DB2 INSERT INTO ASIMPLE1 (COLUMN1) VALUES (‘TESTIN’) So we insert something
DB2 SELECT * FROM ASIMPLE1 Yippee.
RETESTING WITH NEW SOURCE Z390-V.1.8.1
It will be necessary to copy all deliverables for this project over to the new source which sits on my desktop and is known as “new source\z390-v1.8.1:\” and files under it are like those under “c:\z390”, so everything has to be able to work “off the shelf” in that environment.
I’ll have to include JAVA and DB2 within the deliverables or use whatever JAVA is already there. Don’t know about DB2.
It appears that the BAT files have been rewritten in a form I am unfamiliar with and I was not notified of this change. I need to investigate a little further before I email Abe.
IDENTIFICATION DIVISION.
PROGRAM-ID. TESTALL2.
*** AUTHOR-NAME. MICROFOCUS. ENVIRONMENT DIVISION. CONFIGURATION SECTION. SOURCE-COMPUTER. IBM-AT. OBJECT-COMPUTER. IBM-AT. INPUT-OUTPUT SECTION. FILE-CONTROL. DATA DIVISION. FILE SECTION. WORKING-STORAGE SECTION.
01 DISP-RATE PIC $$$,$$$,$$9.99.
01 DISP-COM PIC Z.99.
01 DISP-CODE PIC ----9.
01 FAKE-CHAR PIC X.
01 ANSS PIC X.
01 COM-NULL-IND PIC S9(4) COMP.
EXEC SQL
INCLUDE SQLCA
END-EXEC.
01 emp-no pic x(06) value '000010'.
01 first-name pic x(12) value 'CHRISTINE '.
01 mid-init pic x(01).
01 num pic x(06).
01 nam pic x(12).
01 nam-iv pic s9(04) comp.
01 nim pic x(01).
PROCEDURE DIVISION.
100-MAIN.
EXEC SQL
WHENEVER NOT FOUND
GO TO THEND
END-EXEC
EXEC SQL
WHENEVER NOT FOUND
CONTINUE
END-EXEC
EXEC SQL
WHENEVER SQLERROR
GO TO THEND
END-EXEC
EXEC SQL
WHENEVER SQLERROR
CONTINUE
END-EXEC
EXEC SQL
WHENEVER SQLWARN
GO TO THEND
END-EXEC
EXEC SQL
WHENEVER SQLWARN
CONTINUE
END-EXEC
move '000010' to emp-no.
move 'CHRISTINE ' to first-name.
EXEC SQL
DECLARE THISEMP CURSOR WITHOUT HOLD FOR
SELECT * FROM EMP
WHERE EMPNO = :emp-no
AND FIRSTNME = :first-name
END-EXEC
EXEC SQL
OPEN THISEMP
END-EXEC
EXEC SQL
FETCH THISEMP
INTO :emp-no, :first-name, :mid-init
END-EXEC
DISPLAY 'TESTALL2=F==' SQLCODE.
DISPLAY 'TESTALL2====EMP-NO ' EMP-NO.
DISPLAY 'TESTALL2====FIRST-NAME' FIRST-NAME.
DISPLAY 'TESTALL2====MID-INIT ' MID-INIT.
EXEC SQL
CLOSE THISEMP
END-EXEC
move '000010' to emp-no.
move 'CHRISTINE ' to first-name.
EXEC SQL
DECLARE THATEMP CURSOR FOR
SELECT * FROM EMP
WHERE EMPNO = :emp-no
AND FIRSTNME = :first-name
END-EXEC
EXEC SQL
OPEN THATEMP
END-EXEC
EXEC SQL
FETCH THATEMP
INTO :emp-no, :first-name, :mid-init
END-EXEC
DISPLAY 'TESTALL2=F==' SQLCODE.
DISPLAY 'TESTALL2====EMP-NO ' EMP-NO.
DISPLAY 'TESTALL2====FIRST-NAME' FIRST-NAME.
DISPLAY 'TESTALL2====MID-INIT ' MID-INIT.
EXEC SQL
CLOSE THATEMP
END-EXEC
move '000010' to emp-no.
move 'CHRISTINE ' to first-name.
EXEC SQL
SELECT EMPNO, FIRSTNME, MIDINIT
INTO :emp-no, :first-name, :mid-init
FROM EMP
WHERE EMPNO = :emp-no
AND FIRSTNME = :first-name
END-EXEC
DISPLAY 'TESTALL2=S==' SQLCODE.
DISPLAY 'TESTALL2====EMP-NO ' EMP-NO.
DISPLAY 'TESTALL2====FIRST-NAME' FIRST-NAME.
DISPLAY 'TESTALL2====MID-INIT ' MID-INIT.
move '000015' to EMP-NO.
move 'CHRISTINE ' to first-name.
EXEC SQL
SELECT *
INTO :num, :nam:nam-iv, :nim
FROM EMP
WHERE EMPNO = :EMP-NO
END-EXEC
DISPLAY 'TESTALL2=S==' SQLCODE.
DISPLAY 'TESTALL2====num ' num.
DISPLAY 'TESTALL2====nam ' nam.
DISPLAY 'TESTALL2====nam-iv' nam-iv.
DISPLAY 'TESTALL2====nim ' nim.
THEND.
STOP RUN.
IDENTIFICATION DIVISION.
PROGRAM-ID. TESTALL3.
*** AUTHOR-NAME. MICROFOCUS. ENVIRONMENT DIVISION. CONFIGURATION SECTION. SOURCE-COMPUTER. IBM-AT. OBJECT-COMPUTER. IBM-AT. INPUT-OUTPUT SECTION. FILE-CONTROL. DATA DIVISION. FILE SECTION. WORKING-STORAGE SECTION. 01 FIELD384 PIC X(10). 01 FIELD388 PIC X(08). 01 FIELD392 PIC X(26). 01 FIELD448. 49 FIELD448-LENGTH PIC S9(04) COMP. 49 FIELD448-CONTENTS PIC X(256). 01 FIELD452 PIC X(32). 01 FIELD484 PIC S9(08)V9(02) COMP-3. 01 FIELD492 PIC S9(18) COMP. 01 FIELD496 PIC S9(09) COMP. 01 FIELD500 PIC S9(04) COMP. 01 FIELD385-IV PIC S9(04) COMP. 01 FIELD389-IV PIC S9(04) COMP. 01 FIELD393-IV PIC S9(04) COMP. 01 FIELD449-IV PIC S9(04) COMP. 01 FIELD453-IV PIC S9(04) COMP. 01 FIELD485-IV PIC S9(04) COMP. 01 FIELD493-IV PIC S9(04) COMP. 01 FIELD497-IV PIC S9(04) COMP. 01 FIELD501-IV PIC S9(04) COMP. 01 FIELD385 PIC X(10). 01 FIELD389 PIC X(08). 01 FIELD393 PIC X(26). 01 FIELD449. 49 FIELD449-LENGTH PIC S9(04) COMP. 49 FIELD449-CONTENTS PIC X(256). 01 FIELD453 PIC X(32). 01 FIELD485 PIC S9(09)V9(02) COMP-3. 01 FIELD493 PIC S9(18) COMP. 01 FIELD497 PIC S9(09) COMP. 01 FIELD501 PIC S9(04) COMP.
EXEC SQL
INCLUDE SQLCA
END-EXEC.
PROCEDURE DIVISION.
EXEC SQL
DECLARE THISEMP CURSOR WITH HOLD FOR
SELECT FIELD384,
FIELD388,
FIELD392,
FIELD448,
FIELD452,
FIELD484,
FIELD492,
FIELD496,
FIELD500,
FIELD385,
FIELD389,
FIELD393,
FIELD449,
FIELD453,
FIELD485,
FIELD493,
FIELD497,
FIELD501
FROM DB2DATA
END-EXEC.
EXEC SQL
OPEN THISEMP
END-EXEC.
PERFORM UNTIL SQLCODE = 100
MOVE SPACES TO FIELD384
MOVE SPACES TO FIELD388
MOVE SPACES TO FIELD392
MOVE ZEROES TO FIELD448-LENGTH
MOVE SPACES TO FIELD448-CONTENTS
MOVE SPACES TO FIELD452
MOVE ZEROES TO FIELD484
MOVE ZEROES TO FIELD492
MOVE ZEROES TO FIELD496
MOVE ZEROES TO FIELD500
MOVE ZEROES TO FIELD385-IV
MOVE ZEROES TO FIELD389-IV
MOVE ZEROES TO FIELD393-IV
MOVE ZEROES TO FIELD449-IV
MOVE ZEROES TO FIELD453-IV
MOVE ZEROES TO FIELD485-IV
MOVE ZEROES TO FIELD493-IV
MOVE ZEROES TO FIELD497-IV
MOVE ZEROES TO FIELD501-IV
MOVE SPACES TO FIELD385
MOVE SPACES TO FIELD389
MOVE SPACES TO FIELD393
MOVE ZEROES TO FIELD449-LENGTH
MOVE SPACES TO FIELD449-CONTENTS
MOVE SPACES TO FIELD453
MOVE ZEROES TO FIELD485
MOVE ZEROES TO FIELD493
MOVE ZEROES TO FIELD497
MOVE ZEROES TO FIELD501
EXEC SQL
FETCH THISEMP
INTO :FIELD384,
:FIELD388,
:FIELD392,
:FIELD448,
:FIELD452,
:FIELD484,
:FIELD492,
:FIELD496,
:FIELD500,
:FIELD385:FIELD385-IV,
:FIELD389:FIELD389-IV,
:FIELD393:FIELD393-IV,
:FIELD449:FIELD449-IV,
:FIELD453:FIELD453-IV,
:FIELD485:FIELD485-IV,
:FIELD493:FIELD493-IV,
:FIELD497:FIELD497-IV,
:FIELD501:FIELD501-IV
END-EXEC
IF SQLCODE = +100
DISPLAY 'TESTALL3 GOT +100'
ELSE
DISPLAY 'TESTALL3====FIELD384====' FIELD384 '<<<<'
DISPLAY 'TESTALL3====FIELD388====' FIELD388 '<<<<'
DISPLAY 'TESTALL3====FIELD392====' FIELD392 '<<<<'
DISPLAY 'TESTALL3====FIELD448====' FIELD448-LENGTH
FIELD448-CONTENTS '<<<<'
DISPLAY 'TESTALL3====FIELD452====' FIELD452 '<<<<'
DISPLAY 'TESTALL3====FIELD484====' FIELD484 '<<<<'
DISPLAY 'TESTALL3====FIELD492====' FIELD492 '<<<<'
DISPLAY 'TESTALL3====FIELD496====' FIELD496 '<<<<'
DISPLAY 'TESTALL3====FIELD500====' FIELD500 '<<<<'
DISPLAY 'TESTALL3====FIELD385-IV=' FIELD385-IV '<<<<'
DISPLAY 'TESTALL3====FIELD389-IV=' FIELD389-IV '<<<<'
DISPLAY 'TESTALL3====FIELD393-IV=' FIELD393-IV '<<<<'
DISPLAY 'TESTALL3====FIELD449-IV=' FIELD449-IV '<<<<'
DISPLAY 'TESTALL3====FIELD453-IV=' FIELD453-IV '<<<<'
DISPLAY 'TESTALL3====FIELD485-IV=' FIELD485-IV '<<<<'
DISPLAY 'TESTALL3====FIELD493-IV=' FIELD493-IV '<<<<'
DISPLAY 'TESTALL3====FIELD497-IV=' FIELD497-IV '<<<<'
DISPLAY 'TESTALL3====FIELD501-IV=' FIELD501-IV '<<<<'
DISPLAY 'TESTALL3====FIELD385====' FIELD385 '<<<<'
DISPLAY 'TESTALL3====FIELD389====' FIELD389 '<<<<'
DISPLAY 'TESTALL3====FIELD393====' FIELD393 '<<<<'
DISPLAY 'TESTALL3====FIELD449====' FIELD449-LENGTH
FIELD449-CONTENTS '<<<<'
DISPLAY 'TESTALL3====FIELD453====' FIELD453 '<<<<'
DISPLAY 'TESTALL3====FIELD485====' FIELD485 '<<<<'
DISPLAY 'TESTALL3====FIELD493====' FIELD493 '<<<<'
DISPLAY 'TESTALL3====FIELD497====' FIELD497 '<<<<'
DISPLAY 'TESTALL3====FIELD501====' FIELD501 '<<<<'
END-IF
END-PERFORM.
EXEC SQL
CLOSE THISEMP
END-EXEC.
THEND.
STOP RUN.
IDENTIFICATION DIVISION.
PROGRAM-ID. TESTALL4.
*** AUTHOR-NAME. MICROFOCUS. ENVIRONMENT DIVISION. CONFIGURATION SECTION. SOURCE-COMPUTER. IBM-AT. OBJECT-COMPUTER. IBM-AT. INPUT-OUTPUT SECTION. FILE-CONTROL. DATA DIVISION. FILE SECTION. WORKING-STORAGE SECTION. 01 FIELD384 PIC X(10). 01 FIELD388 PIC X(08). 01 FIELD392 PIC X(19). 01 FIELD448. 49 FIELD448-LENGTH PIC S9(04) COMP. 49 FIELD448-CONTENT PIC X(256). 01 FIELD452 PIC X(32). 01 FIELD484 PIC S9(07)V9(02) COMP-3. 01 FIELD492 PIC S9(18) COMP. 01 FIELD496 PIC S9(09) COMP. 01 FIELD500 PIC S9(04) COMP. 01 FIELD385-IV PIC S9(04) COMP. 01 FIELD389-IV PIC S9(04) COMP. 01 FIELD393-IV PIC S9(04) COMP. 01 FIELD449-IV PIC S9(04) COMP. 01 FIELD453-IV PIC S9(04) COMP. 01 FIELD485-IV PIC S9(04) COMP. 01 FIELD493-IV PIC S9(04) COMP. 01 FIELD497-IV PIC S9(04) COMP. 01 FIELD501-IV PIC S9(04) COMP. 01 FIELD385 PIC X(10). 01 FIELD389 PIC X(08). 01 FIELD393 PIC X(19). 01 FIELD449. 49 FIELD449-LENGTH PIC S9(04) COMP. 49 FIELD449-CONTENT PIC X(256). 01 FIELD453 PIC X(32). 01 FIELD485 PIC S9(07)V9(02) COMP-3. 01 FIELD493 PIC S9(18) COMP. 01 FIELD497 PIC S9(09) COMP. 01 FIELD501 PIC S9(04) COMP. 01 F484S. 03 F484 OCCURS 5 PIC X(01). 01 FUB PIC 9(01). 01 TWOGETHER PIC 9(04) COMP. 01 FILLER REDEFINES TWOGETHER. 03 FILLER PIC X(01) VALUE LOW-VALUES. 03 SECUND PIC X(01). 01 HEXSSS. 03 FILLER PIC X(01) VALUE '0'. 03 FILLER PIC X(01) VALUE '1'. 03 FILLER PIC X(01) VALUE '2'. 03 FILLER PIC X(01) VALUE '3'. 03 FILLER PIC X(01) VALUE '4'. 03 FILLER PIC X(01) VALUE '5'. 03 FILLER PIC X(01) VALUE '6'. 03 FILLER PIC X(01) VALUE '7'. 03 FILLER PIC X(01) VALUE '8'. 03 FILLER PIC X(01) VALUE '9'. 03 FILLER PIC X(01) VALUE 'A'. 03 FILLER PIC X(01) VALUE 'B'. 03 FILLER PIC X(01) VALUE 'C'. 03 FILLER PIC X(01) VALUE 'D'. 03 FILLER PIC X(01) VALUE 'E'. 03 FILLER PIC X(01) VALUE 'F'. 01 HEXSS REDEFINES HEXSSS. 03 HEXS PIC X(01) OCCURS 16. 01 HUB1 PIC 9(04). 01 HUB2 PIC 9(04).
EXEC SQL
INCLUDE SQLCA
END-EXEC.
PROCEDURE DIVISION.
*** 384 MOVE SPACES TO FIELD384. MOVE 0 TO SQLCODE.
EXEC SQL
SELECT FIELD384
INTO :FIELD384
FROM DB2DATA
END-EXEC.
DISPLAY 'SQLCODE=====' SQLCODE '<<<<'.
DISPLAY 'FIELD384====' FIELD384 '<<<<'.
*** 388 MOVE SPACES TO FIELD388. MOVE 0 TO SQLCODE.
EXEC SQL
SELECT FIELD388
INTO :FIELD388
FROM DB2DATA
END-EXEC.
DISPLAY 'SQLCODE=====' SQLCODE '<<<<'.
DISPLAY 'FIELD388====' FIELD388 '<<<<'.
*** 392 MOVE SPACES TO FIELD392. MOVE 0 TO SQLCODE.
EXEC SQL
SELECT FIELD392
INTO :FIELD392
FROM DB2DATA
END-EXEC.
DISPLAY 'SQLCODE=====' SQLCODE '<<<<'.
DISPLAY 'FIELD392====' FIELD392 '<<<<'.
*** 448 MOVE ZEROS TO FIELD448-LENGTH. MOVE SPACES TO FIELD448-CONTENT. MOVE 0 TO SQLCODE.
EXEC SQL
SELECT FIELD448
INTO :FIELD448
FROM DB2DATA
END-EXEC.
DISPLAY 'SQLCODE=============' SQLCODE '<<<<'.
DISPLAY 'FIELD448-LENGTH=====' FIELD448-LENGTH '<<<<'.
DISPLAY 'FIELD448-CONTENT====' FIELD448-CONTENT '<<<<'.
*** 452 MOVE SPACES TO FIELD452. MOVE 0 TO SQLCODE.
EXEC SQL
SELECT FIELD452
INTO :FIELD452
FROM DB2DATA
END-EXEC.
DISPLAY 'SQLCODE=====' SQLCODE '<<<<'.
DISPLAY 'FIELD452====' FIELD452 '<<<<'.
*** 484 MOVE 0 TO SQLCODE.
EXEC SQL
SELECT FIELD484
INTO :FIELD484
FROM DB2DATA
END-EXEC.
DISPLAY 'SQLCODE=====' SQLCODE '<<<<'.
DISPLAY 'FIELD484====' FIELD484 '<<<<'.
*** 492 MOVE ZEROES TO FIELD492. MOVE 0 TO SQLCODE.
EXEC SQL
SELECT FIELD492
INTO :FIELD492
FROM DB2DATA
END-EXEC.
DISPLAY 'SQLCODE=====' SQLCODE '<<<<'.
DISPLAY 'FIELD492====' FIELD492 '<<<<'.
*** 496 MOVE ZEROES TO FIELD496. MOVE 0 TO SQLCODE.
EXEC SQL
SELECT FIELD496
INTO :FIELD496
FROM DB2DATA
END-EXEC.
DISPLAY 'SQLCODE=====' SQLCODE '<<<<'.
DISPLAY 'FIELD496====' FIELD496 '<<<<'.
*** 500 MOVE ZEROES TO FIELD500. MOVE 0 TO SQLCODE.
EXEC SQL
SELECT FIELD500
INTO :FIELD500
FROM DB2DATA
END-EXEC.
DISPLAY 'SQLCODE=====' SQLCODE '<<<<'.
DISPLAY 'FIELD500====' FIELD500 '<<<<'.
*** 385 MOVE ZEROES TO FIELD385-IV. MOVE SPACES TO FIELD385. MOVE 0 TO SQLCODE.
EXEC SQL
SELECT FIELD385
INTO :FIELD385:FIELD385-IV
FROM DB2DATA
END-EXEC.
DISPLAY 'SQLCODE=====' SQLCODE '<<<<'.
DISPLAY 'FIELD385-IV=' FIELD385-IV '<<<<'.
DISPLAY 'FIELD385====' FIELD385 '<<<<'.
*** 389 MOVE ZEROES TO FIELD389-IV. MOVE SPACES TO FIELD389. MOVE 0 TO SQLCODE.
EXEC SQL
SELECT FIELD389
INTO :FIELD389:FIELD389-IV
FROM DB2DATA
END-EXEC.
DISPLAY 'SQLCODE=====' SQLCODE '<<<<'.
DISPLAY 'FIELD389-IV=' FIELD389-IV '<<<<'.
DISPLAY 'FIELD389====' FIELD389 '<<<<'.
*** 393 MOVE ZEROES TO FIELD393-IV. MOVE SPACES TO FIELD393. MOVE 0 TO SQLCODE.
EXEC SQL
SELECT FIELD393
INTO :FIELD393:FIELD393-IV
FROM DB2DATA
END-EXEC.
DISPLAY 'SQLCODE=====' SQLCODE '<<<<'.
DISPLAY 'FIELD393-IV=' FIELD393-IV '<<<<'.
DISPLAY 'FIELD393====' FIELD393 '<<<<'.
*** 449 MOVE ZEROES TO FIELD449-IV. MOVE 0 TO FIELD449-LENGTH. MOVE 0 TO SQLCODE.
EXEC SQL
SELECT FIELD449
INTO :FIELD449:FIELD449-IV
FROM DB2DATA
END-EXEC.
DISPLAY 'SQLCODE=====' SQLCODE '<<<<'.
DISPLAY 'FIELD449-IV=' FIELD449-IV '<<<<'.
DISPLAY 'FIELD449-LENGTH===='
FIELD449-LENGTH '<<<<'.
DISPLAY 'FIELD449-CONTENT===='
FIELD449-CONTENT '<<<<'.
*** 453 MOVE ZEROES TO FIELD453-IV. MOVE SPACES TO FIELD453. MOVE 0 TO SQLCODE.
EXEC SQL
SELECT FIELD453
INTO :FIELD453:FIELD453-IV
FROM DB2DATA
END-EXEC.
DISPLAY 'SQLCODE=====' SQLCODE '<<<<'.
DISPLAY 'FIELD453-IV=' FIELD453-IV '<<<<'.
DISPLAY 'FIELD453====' FIELD453 '<<<<'.
*** 485 MOVE ZEROES TO FIELD485-IV. MOVE ZEROES TO FIELD485. MOVE 0 TO SQLCODE.
EXEC SQL
SELECT FIELD485
INTO :FIELD485:FIELD485-IV
FROM DB2DATA
END-EXEC.
DISPLAY 'SQLCODE=====' SQLCODE '<<<<'.
DISPLAY 'FIELD485-IV=' FIELD485-IV '<<<<'.
DISPLAY 'FIELD485====' FIELD485 '<<<<'.
*** 493 MOVE ZEROES TO FIELD493-IV. MOVE ZEROES TO FIELD493. MOVE 0 TO SQLCODE.
EXEC SQL
SELECT FIELD493
INTO :FIELD493:FIELD493-IV
FROM DB2DATA
END-EXEC.
DISPLAY 'SQLCODE=====' SQLCODE '<<<<'.
DISPLAY 'FIELD493-IV=' FIELD493-IV '<<<<'.
DISPLAY 'FIELD493====' FIELD493 '<<<<'.
*** 497 MOVE ZEROES TO FIELD497-IV. MOVE ZEROES TO FIELD497. MOVE 0 TO SQLCODE.
EXEC SQL
SELECT FIELD497
INTO :FIELD497:FIELD497-IV
FROM DB2DATA
END-EXEC.
DISPLAY 'SQLCODE=====' SQLCODE '<<<<'.
DISPLAY 'FIELD497-IV=' FIELD497-IV '<<<<'.
DISPLAY 'FIELD497====' FIELD497 '<<<<'.
*** 501 MOVE ZEROES TO FIELD501-IV. MOVE ZEROES TO FIELD501. MOVE 0 TO SQLCODE.
EXEC SQL
SELECT FIELD501
INTO :FIELD501:FIELD501-IV
FROM DB2DATA
END-EXEC.
DISPLAY 'SQLCODE=====' SQLCODE '<<<<'.
DISPLAY 'FIELD501-IV=' FIELD501-IV '<<<<'.
DISPLAY 'FIELD501====' FIELD501 '<<<<'.
THEND.
STOP RUN.
IDENTIFICATION DIVISION.
PROGRAM-ID. TESTALL5.
*** AUTHOR-NAME. MICROFOCUS. ENVIRONMENT DIVISION. CONFIGURATION SECTION. SOURCE-COMPUTER. IBM-AT. OBJECT-COMPUTER. IBM-AT. INPUT-OUTPUT SECTION. FILE-CONTROL. DATA DIVISION. FILE SECTION. WORKING-STORAGE SECTION. 01 ID PIC X(06). 01 GIVEN PIC X(12). 01 INIT PIC X(01).
01 MI PIC X(01) VALUE 'K'.
01 GIVEN-IND PIC S9(04) COMP.
EXEC SQL
INCLUDE SQLCA
END-EXEC.
PROCEDURE DIVISION.
MOVE 0 TO SQLCODE.
EXEC SQL
DROP TABLE EMP
END-EXEC.
DISPLAY 'TESTALL5=drop table emp===' SQLCODE.
MOVE 0 TO SQLCODE.
EXEC SQL
CREATE TABLE EMP(
EMPNO CHAR(06) NOT NULL,
FIRSTNME CHAR(12),
MIDINIT CHAR(01) NOT NULL,
PRIMARY KEY (EMPNO))
END-EXEC.
DISPLAY 'TESTALL5=create table emp===' SQLCODE.
MOVE 0 TO SQLCODE.
EXEC SQL
INSERT INTO EMP( empno, firstnme, midinit)
VALUES ('000005', 'JOHN ', 'C')
END-EXEC.
DISPLAY 'TESTALL5=insert into emp===' SQLCODE.
MOVE 0 TO SQLCODE.
EXEC SQL
INSERT INTO EMP( empno, firstnme, midinit)
VALUES ('000010', 'CHRISTINE ', 'K')
END-EXEC.
DISPLAY 'TESTALL5=insert into emp===' SQLCODE.
MOVE 0 TO SQLCODE.
EXEC SQL
INSERT INTO EMP( empno, firstnme, midinit)
VALUES ('000015', NULL , 'Z')
END-EXEC.
DISPLAY 'TESTALL5=insert into emp===' SQLCODE.
MOVE 0 TO SQLCODE.
EXEC SQL
SELECT *
INTO :ID, :GIVEN:GIVEN-IND, :INIT
FROM EMP
WHERE MIDINIT > :MI
END-EXEC.
DISPLAY 'TESTALL5=select from emp===' SQLCODE.
IF SQLCODE = 0
DISPLAY 'TESTALL5==== ID ' ID
IF GIVEN-IND = -1
DISPLAY 'TESTALL5==== GIVEN IS NULL'
ELSE
DISPLAY 'TESTALL5==== GIVEN' GIVEN
END-IF
DISPLAY 'TESTALL5==== INIT ' INIT
END-IF.
THEND.
STOP RUN.
IDENTIFICATION DIVISION.
PROGRAM-ID. TESTALL6.
*** AUTHOR-NAME. MICROFOCUS. ENVIRONMENT DIVISION. CONFIGURATION SECTION. SOURCE-COMPUTER. IBM-AT. OBJECT-COMPUTER. IBM-AT. INPUT-OUTPUT SECTION. FILE-CONTROL. DATA DIVISION. FILE SECTION. WORKING-STORAGE SECTION. 01 ID PIC X(06). 01 GIVEN PIC X(12). 01 INIT PIC X(01).
01 MI PIC X(01) VALUE 'K'.
01 GIVEN-IND PIC S9(04) COMP.
EXEC SQL
INCLUDE SQLCA
END-EXEC.
PROCEDURE DIVISION.
MOVE 0 TO SQLCODE.
EXEC SQL
DROP TABLE EMP
END-EXEC.
DISPLAY 'TESTALL6=drop===' SQLCODE.
MOVE 0 TO SQLCODE.
EXEC SQL
CREATE TABLE EMP(
EMPNO CHAR(06) NOT NULL,
FIRSTNME CHAR(12),
MIDINIT CHAR(01) NOT NULL,
PRIMARY KEY (EMPNO))
END-EXEC.
DISPLAY 'TESTALL6=create===' SQLCODE.
MOVE 0 TO SQLCODE.
EXEC SQL
INSERT INTO EMP( EMPNO, FIRSTNME, MIDINIT)
VALUES ('000005', 'JOHN ', 'C')
END-EXEC.
DISPLAY 'TESTALL6=insert===' SQLCODE.
MOVE 0 TO SQLCODE.
EXEC SQL
INSERT INTO EMP( EMPNO, FIRSTNME, MIDINIT)
VALUES ('000010', 'CHRISTINE ', 'K')
END-EXEC.
DISPLAY 'TESTALL6=insert===' SQLCODE.
MOVE 0 TO SQLCODE.
EXEC SQL
INSERT INTO EMP( EMPNO, FIRSTNME, MIDINIT)
VALUES ('000015', NULL , 'Z')
END-EXEC.
DISPLAY 'TESTALL6=insert===' SQLCODE.
MOVE 0 TO SQLCODE.
EXEC SQL
LOCK TABLE EMP IN EXCLUSIVE MODE
END-EXEC.
DISPLAY 'TESTALL6=lock===' SQLCODE.
MOVE 0 TO SQLCODE.
EXEC SQL
DECLARE C1 SENSITIVE STATIC SCROLL CURSOR FOR
SELECT *
FROM EMP
WHERE MIDINIT > :MI
FOR UPDATE OF FIRSTNME
END-EXEC.
DISPLAY 'TESTALL6=declare cursor===' SQLCODE.
MOVE 0 TO SQLCODE.
EXEC SQL
OPEN C1
END-EXEC.
DISPLAY 'TESTALL6=open cursor===' SQLCODE.
MOVE 0 TO SQLCODE.
EXEC SQL
FETCH C1
INTO :ID, :GIVEN:GIVEN-IND, :INIT
END-EXEC.
DISPLAY 'TESTALL6=fetch cursor===' SQLCODE.
IF SQLCODE = 0
DISPLAY 'TESTALL6==== ID ' ID
IF GIVEN-IND = -1
DISPLAY 'TESTALL6==== GIVEN IS NULL'
ELSE
DISPLAY 'TESTALL6==== GIVEN' GIVEN
END-IF
DISPLAY 'TESTALL6==== INIT ' INIT
END-IF.
MOVE 0 TO SQLCODE.
EXEC SQL
UPDATE EMP
SET FIRSTNME = 'FILLED'
WHERE CURRENT OF C1
END-EXEC.
DISPLAY 'TESTALL6=update where current of cursor===' SQLCODE.
MOVE 0 TO SQLCODE.
EXEC SQL
SELECT *
INTO :ID, :GIVEN:GIVEN-IND, :INIT
FROM EMP
WHERE MIDINIT > :MI
END-EXEC.
DISPLAY 'TESTALL6=select===' SQLCODE.
IF SQLCODE = 0
DISPLAY 'TESTALL6==== ID ' ID
IF GIVEN-IND = -1
DISPLAY 'TESTALL6==== GIVEN IS NULL'
ELSE
DISPLAY 'TESTALL6==== GIVEN' GIVEN
END-IF
DISPLAY 'TESTALL6==== INIT ' INIT
END-IF.
MOVE 0 TO SQLCODE.
EXEC SQL
CLOSE C1
END-EXEC.
DISPLAY 'TESTALL6=close cursor===' SQLCODE.
THEND.
STOP RUN.
IDENTIFICATION DIVISION.
PROGRAM-ID. TESTALL7.
*** AUTHOR-NAME. MICROFOCUS. ENVIRONMENT DIVISION. CONFIGURATION SECTION. SOURCE-COMPUTER. IBM-AT. OBJECT-COMPUTER. IBM-AT. INPUT-OUTPUT SECTION. FILE-CONTROL. DATA DIVISION. FILE SECTION. WORKING-STORAGE SECTION. 01 IHARM PIC S9(08) COMP. 01 LHARM. 49 LHARM-LENGTH PIC S9(04) COMP. 49 LHARM-CONTENT PIC X(32). 01 DHARM PIC X(10). 01 VHARM. 49 VHARM-LENGTH PIC S9(04) COMP. 49 VHARM-CONTENT PIC X(32). 01 SMARM PIC S9(08) COMP.
EXEC SQL
INCLUDE SQLCA
END-EXEC.
PROCEDURE DIVISION.
MOVE 0 TO SQLCODE.
EXEC SQL
SELECT 'blue mountain''s sceneryABCDEFGHIJ'
INTO :VHARM
FROM DB2DATA
END-EXEC.
DISPLAY 'TESTALL7====' SQLCODE.
IF SQLCODE = 0
DISPLAY 'TESTALL7==== VHARM ' VHARM-LENGTH
VHARM-CONTENT
END-IF.
MOVE 0 TO SQLCODE.
EXEC SQL
SELECT COUNT(*)
INTO :SMARM
FROM DB2DATA
END-EXEC.
DISPLAY 'TESTALL7====' SQLCODE.
IF SQLCODE = 0
DISPLAY 'TESTALL7==== SMARM ' SMARM
END-IF.
MOVE 0 TO SQLCODE.
EXEC SQL
SELECT (SELECT FIELD384 FROM DB2DATA
WHERE FIELD388 = '01:02:03')
INTO :DHARM
FROM SYSIBM.SYSDUMMY1
END-EXEC.
DISPLAY 'TESTALL7====' SQLCODE.
IF SQLCODE = 0
DISPLAY 'TESTALL7==== DHARM ' DHARM
END-IF.
MOVE 0 TO SQLCODE.
MOVE SPACES TO LHARM-CONTENT.
EXEC SQL
SELECT 1,
'2',
(SELECT FIELD384 FROM DB2DATA
WHERE FIELD388 = '01:02:03')
INTO :IHARM,
:LHARM,
:DHARM
FROM SYSIBM.SYSDUMMY1
END-EXEC.
DISPLAY 'TESTALL7====' SQLCODE.
IF SQLCODE = 0
DISPLAY 'TESTALL7==== IHARM ' IHARM
DISPLAY 'TESTALL7==== LHARM ' LHARM-LENGTH
LHARM-CONTENT
DISPLAY 'TESTALL7==== DHARM ' DHARM
END-IF.
THEND.
STOP RUN.
IDENTIFICATION DIVISION.
PROGRAM-ID. TESTALL8.
*** AUTHOR-NAME. MICROFOCUS. ENVIRONMENT DIVISION. CONFIGURATION SECTION. SOURCE-COMPUTER. IBM-AT. OBJECT-COMPUTER. IBM-AT. INPUT-OUTPUT SECTION. FILE-CONTROL. DATA DIVISION. FILE SECTION. WORKING-STORAGE SECTION. 01 ID PIC X(06). 01 GIVEN PIC X(12). 01 INIT PIC X(01).
01 MI PIC X(01) VALUE 'K'.
01 GIVEN-IND PIC S9(04) COMP.
EXEC SQL
INCLUDE SQLCA
END-EXEC.
PROCEDURE DIVISION.
MOVE 0 TO SQLCODE.
EXEC SQL
DROP TABLE EMP
END-EXEC.
DISPLAY 'TESTALL8=drop===' SQLCODE.
MOVE 0 TO SQLCODE.
EXEC SQL
CREATE TABLE EMP(
EMPNO CHAR(06) NOT NULL,
FIRSTNME CHAR(12),
MIDINIT CHAR(01) NOT NULL,
PRIMARY KEY (EMPNO))
END-EXEC.
DISPLAY 'TESTALL8=create===' SQLCODE.
MOVE 0 TO SQLCODE.
EXEC SQL
INSERT INTO EMP( empno, firstnme, midinit)
VALUES ('000005', 'JOHN ', 'C')
END-EXEC.
DISPLAY 'TESTALL8=insert===' SQLCODE.
MOVE 0 TO SQLCODE.
EXEC SQL
INSERT INTO EMP( empno, firstnme, midinit)
VALUES ('000010', 'CHRISTINE ', 'K')
END-EXEC.
DISPLAY 'TESTALL8=insert===' SQLCODE.
MOVE 0 TO SQLCODE.
EXEC SQL
INSERT INTO EMP( empno, firstnme, midinit)
VALUES ('000015', NULL , 'Z')
END-EXEC.
DISPLAY 'TESTALL8=insert===' SQLCODE.
MOVE 0 TO SQLCODE.
EXEC SQL
LOCK TABLE EMP IN EXCLUSIVE MODE
END-EXEC.
DISPLAY 'TESTALL8=lock===' SQLCODE.
MOVE 0 TO SQLCODE.
EXEC SQL
DECLARE C1 CURSOR FOR
SELECT *
FROM EMP
FOR UPDATE OF FIRSTNME
END-EXEC.
DISPLAY 'TESTALL8=declare cursor for update of===' SQLCODE.
MOVE 0 TO SQLCODE.
EXEC SQL
OPEN C1
END-EXEC.
DISPLAY 'TESTALL8=open cursor===' SQLCODE.
MOVE 0 TO SQLCODE.
EXEC SQL
FETCH C1
INTO :ID, :GIVEN:GIVEN-IND, :INIT
END-EXEC.
DISPLAY 'TESTALL8=fetch cursor===' SQLCODE.
IF SQLCODE = 0
DISPLAY 'TESTALL8==== ID ' ID
IF GIVEN-IND = -1
DISPLAY 'TESTALL8==== GIVEN IS NULL'
ELSE
DISPLAY 'TESTALL8==== GIVEN' GIVEN
END-IF
DISPLAY 'TESTALL8==== INIT ' INIT
END-IF.
MOVE 0 TO SQLCODE.
EXEC SQL
UPDATE EMP
SET firstnme = 'FILLED'
WHERE EMPNO = :ID
END-EXEC.
DISPLAY 'TESTALL8=update via primary key===' SQLCODE.
MOVE 0 TO SQLCODE.
EXEC SQL
SELECT *
INTO :ID, :GIVEN:GIVEN-IND, :INIT
FROM EMP
WHERE FIRSTNME = 'FILLED'
END-EXEC.
DISPLAY 'TESTALL8=select===' SQLCODE.
IF SQLCODE = 0
DISPLAY 'TESTALL8==== ID ' ID
IF GIVEN-IND = -1
DISPLAY 'TESTALL8==== GIVEN IS NULL'
ELSE
DISPLAY 'TESTALL8==== GIVEN' GIVEN
END-IF
DISPLAY 'TESTALL8==== INIT ' INIT
END-IF.
MOVE 0 TO SQLCODE.
EXEC SQL
CLOSE C1
END-EXEC.
DISPLAY 'TESTALL8=close cursor===' SQLCODE.
MOVE '000005' TO ID.
MOVE 0 TO SQLCODE.
EXEC SQL
DELETE FROM EMP
WHERE EMPNO = :ID
END-EXEC.
DISPLAY 'TESTALL8=delete===' SQLCODE.
THEND.
STOP RUN.
IDENTIFICATION DIVISION.
PROGRAM-ID. TESTALL9.
*** AUTHOR-NAME. MICROFOCUS. ENVIRONMENT DIVISION. CONFIGURATION SECTION. SOURCE-COMPUTER. IBM-AT. OBJECT-COMPUTER. IBM-AT. INPUT-OUTPUT SECTION. FILE-CONTROL. DATA DIVISION. FILE SECTION. WORKING-STORAGE SECTION.
EXEC SQL
INCLUDE SQLCA
END-EXEC.
PROCEDURE DIVISION.
MOVE 0 TO SQLCODE.
EXEC SQL
CONNECT TO CHOOKY
END-EXEC.
DISPLAY 'TESTALL9=connect===' SQLCODE.
MOVE 0 TO SQLCODE.
EXEC SQL
DROP TABLE USER.SYSTABLES
END-EXEC.
DISPLAY 'TESTALL9=drop===' SQLCODE.
MOVE 0 TO SQLCODE.
EXEC SQL
WITH
USER.SYSTABLES (NAME, TYPE, CTIME) AS
(SELECT SUBSTR(NAME,1,12),
TYPE,
CTIME
FROM Sysibm.SysTables)
SELECT * FROM USER.SYSTABLES
WHERE TYPE = 'T'
END-EXEC.
DISPLAY 'TESTALL9=with===' SQLCODE.
MOVE 0 TO SQLCODE.
EXEC SQL
CONNECT RESET
END-EXEC.
DISPLAY 'TESTALL9=cconnect reset===' SQLCODE.
MOVE 0 TO SQLCODE.
EXEC SQL
TERMINATE
END-EXEC.
DISPLAY 'TESTALL9=terminate===' SQLCODE.
MOVE 0 TO SQLCODE.
EXEC SQL
QUIT
END-EXEC.
DISPLAY 'TESTALL9=quit===' SQLCODE.
THEND.
STOP RUN.
IDENTIFICATION DIVISION.
PROGRAM-ID. DB2PREPY.
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT IN-FILE
ASSIGN TO INFILE
ORGANIZATION IS LINE SEQUENTIAL.
SELECT OUT-FILE
ASSIGN TO OUTFILE
ORGANIZATION IS LINE SEQUENTIAL.
DATA DIVISION.
FILE SECTION.
FD IN-FILE
DATA RECORD IS IN-RECORD.
01 IN-RECORD.
03 IN-8 PIC X(08).
03 IN-REST PIC X(72).
FD OUT-FILE
DATA RECORD IS OUT-RECORD.
01 OUT-RECORD PIC X(80).
WORKING-STORAGE SECTION.
01 PD-AT PIC 9(04) VALUE 0.
01 DUP-LINESS.
03 DUP-LINES OCCURS 999.
05 DUP-LINE-CONTENTS PIC X(02).
07 DUP-LINE-CONT-LL PIC X(02). 07 DUP-LINE-CONT-RR PIC 9(02).
01 SQL-LINESS. 03 SQL-LINES OCCURS 99. *** 05 SQL-LINE PIC X(61).
01 COPY-LINESS. 03 COPY-LINES OCCURS 99. *** 05 COPY-LINE PIC X(61).
01 HOLD-FOUND PIC X(01) VALUE 'N'. 01 HOLD-AT PIC 9(02) VALUE 0.
01 SQUB1 PIC 9(04) VALUE 0. 01 SQUB2 PIC 9(04) VALUE 0. 01 SQUB3 PIC 9(04) VALUE 0. 01 SQUB4 PIC 9(04) VALUE 0. 01 SQUB5 PIC 9(04) VALUE 0. 01 SQUB6 PIC 9(04) VALUE 0. 01 SQUB7 PIC 9(04) VALUE 0. 01 SQUB8 PIC 9(04) VALUE 0. *** 01 SQUB9 PIC 9(04) VALUE 0.
01 PREV-KWOTE PIC X(01) VALUE 'N'. 01 PREV-SPACE PIC X(01) VALUE 'N'.
01 THE-CURSORSS. 03 THE-CURSORS OCCURS 20. *** 05 THE-CURSOR PIC X(128).
01 CURB1 PIC 9(02) VALUE 0. 01 CURB2 PIC 9(02) VALUE 0. *** 01 CURB3 PIC 9(02) VALUE 0. 01 CURSOR-FOUND PIC X(01) VALUE 'N'.
01 THE-DESCRIBESS. 03 THE-DESCRIBES OCCURS 99. *** 05 THE-DESCRIBE PIC X(60).
01 DESB1 PIC 9(03) VALUE 0. 01 DESB2 PIC 9(03) VALUE 0. 01 DESB3 PIC 9(03) VALUE 0. 01 DESCRIBE-NOF-COLUMNS PIC 9(06). 01 SQL-RESULT-FILE-ENDED PIC X(01) VALUE 'N'.
01 EXEC-SQL-FOUND PIC X(01) VALUE 'N'.
01 END-EXEC-FOUND PIC X(01) VALUE 'N'.
01 INCLUDE-FOUND PIC X(01) VALUE 'N'.
01 WORKING-STORAGE-FOUND PIC X(01) VALUE 'N'.
01 SQL-TRUNC PIC X(60).
01 WNFSS. 03 WNFS OCCURS 10. 05 WNF-ID PIC X(06). 05 WNF-INSTR PIC X(50). 01 WNFUB1 PIC 9(04). 01 WNFUB2 PIC 9(04).
01 WSESS. 03 WSES OCCURS 10. 05 WSE-ID PIC X(06). 05 WSE-INSTR PIC X(50). 01 WSEUB1 PIC 9(04). 01 WSEUB2 PIC 9(04).
01 WSWSS. 03 WSWS OCCURS 10. 05 WSW-ID PIC X(06). 05 WSW-INSTR PIC X(50). 01 WSWUB1 PIC 9(04). 01 WSWUB2 PIC 9(04).
01 KWOTE PIC X(01) VALUE ''''.
01 INSERTSS.
03 INSERTS OCCURS 99.
05 INSERT-HDR PIC X(06).
05 INSERT-BODY PIC X(66).
05 INSERT-TAIL PIC X(08).
01 IUB1 PIC 9(04).
01 IUB2 PIC 9(04).
01 SQL-RECS. 03 SQL-REC OCCURS 20. 05 SQL-HDR PIC X(07). 05 SQL-STMT PIC X(2048). 01 SQLUB1 PIC 9(04) VALUE 0. 01 SQLUB2 PIC 9(04). *** 01 SQLCUB1 PIC 9(04).
01 FIFTY-BYTES PIC X(50).
01 END-OF-FILE-FLAG PIC X VALUE 'F'.
01 SINGUL PIC X(01).
01 SQL-BUFFER1 PIC X(2048). 01 SQL-BUFFER2 PIC X(2048). 01 SQLSQL. 03 FILLER PIC X(03) VALUE 'SQL'. 03 SQL-COUNTER PIC 9(03) VALUE 0. 03 FILLER PIC X(01) VALUE '*'. 01 THE-LINES. 03 THE-LINE PIC X(80) OCCURS 999. 01 LLUB1 PIC 9(04). 01 LLUB2 PIC 9(04). 01 LLUB3 PIC 9(04). 01 LLUB4 PIC 9(04). 01 LLUB5 PIC 9(04). 01 LLUB6 PIC 9(04). 01 CUB1 PIC 9(04). 01 STOP-RUN-FOUND PIC X(01).
01 EXEC-FOUND PIC X(01).
01 SQL-FOUND PIC X(01).
01 END-X-FOUND PIC X(01).
01 ERROR-MSGS.
03 ER01 PIC X(70) VALUE
'DB2PREPZ - THE-LINE ARRAY MAXED OUT(999)'.
03 ER07 PIC X(70) VALUE
'DB2PREPZ - "EXEC"/"SQL" ERROR'.
03 ER08 PIC X(70) VALUE
'DB2PREPZ - "SQL"/"END-EXEC" ERROR'.
03 ER09 PIC X(70) VALUE
'DB2PREPZ - "EXEC"/"SQL"/"END-EXEC" MISMATCH'.
03 ER10 PIC X(70) VALUE
'DB2PREPZ - LOGIC ERROR'.
03 ER11 PIC X(70) VALUE
'DB2PREPZ - "FROM" NOT FOUND'.
01 SIXTYFOURCHAR PIC X(64).
01 THIRTYONECHAR PIC X(31).
01 TWENTYSIXCHAR PIC X(26).
01 PD-FLAG PIC X(01) VALUE 'N'.
01 PD-FOUND-AT PIC 9(04).
01 PD-FIRST PIC X(01) VALUE 'N'.
01 PARA-FIRST PIC X(01) VALUE 'N'.
01 WS-CHARS.
03 EIGHTEENCHAR PIC X(18).
03 FILLER REDEFINES EIGHTEENCHAR.
05 SEVENTEENCHAR PIC X(17).
05 FILLER PIC X(01).
03 FILLER REDEFINES EIGHTEENCHAR.
05 SIXTEENCHAR PIC X(16).
05 FILLER PIC X(02).
03 FILLER REDEFINES EIGHTEENCHAR.
05 FIFTEENCHAR PIC X(15).
05 FILLER PIC X(03).
03 FILLER REDEFINES EIGHTEENCHAR.
05 FOURTEENCHAR PIC X(14).
05 FILLER PIC X(04).
03 FILLER REDEFINES EIGHTEENCHAR.
05 THIRTEENCHAR PIC X(13).
05 FILLER PIC X(05).
03 FILLER REDEFINES EIGHTEENCHAR.
05 TWELVECHAR PIC X(12).
05 FILLER PIC X(06).
03 FILLER REDEFINES EIGHTEENCHAR.
05 ELEVENCHAR PIC X(11).
05 FILLER PIC X(07).
03 FILLER REDEFINES EIGHTEENCHAR.
05 TENCHAR PIC X(10).
05 FILLER PIC X(08).
03 FILLER REDEFINES EIGHTEENCHAR.
05 NINECHAR PIC X(09).
05 FILLER PIC X(09).
03 FILLER REDEFINES EIGHTEENCHAR.
05 EIGHTCHAR PIC X(08).
05 FILLER PIC X(10).
03 FILLER REDEFINES EIGHTEENCHAR.
05 SEVENCHAR PIC X(07).
05 FILLER PIC X(11).
03 FILLER REDEFINES EIGHTEENCHAR.
05 SIXCHAR PIC X(06).
05 FILLER PIC X(12).
03 FILLER REDEFINES EIGHTEENCHAR.
05 FIVECHAR PIC X(05).
05 FILLER PIC X(13).
03 FILLER REDEFINES EIGHTEENCHAR.
05 FOURCHAR PIC X(04).
05 FILLER PIC X(14).
03 FILLER REDEFINES EIGHTEENCHAR.
05 THREECHAR PIC X(03).
05 FILLER PIC X(15).
03 FILLER REDEFINES EIGHTEENCHAR.
05 TWOCHAR PIC X(02).
05 FILLER PIC X(16).
03 FILLER REDEFINES EIGHTEENCHAR.
05 ONECHAR PIC X(01).
05 FILLER PIC X(17).
01 THE-FIVECHAR.
03 syne pic x(01).
03 nine4 pic 9(04).
01 SIXCHAR2 PIC X(06).
01 DUMMY PIC X(1).
LINKAGE SECTION.
PROCEDURE DIVISION.
MAINLINE.
MOVE 0 TO RETURN-CODE.
PERFORM INITIALIZATION-ROUTINE THRU IRX.
IF RETURN-CODE NOT = 0
DISPLAY 'DB2PREPY - Error in Initialization'
MOVE 16 TO RETURN-CODE
GO THEVERYEND
END-IF.
store in an array the extra lines that are to appear at the start of the working storage of the target program
MOVE 1 TO IUB1.
MOVE 'WS' TO INSERT-HDR(IUB1).
MOVE ' 01 EYECATCHER PIC X(02).'
TO INSERT-BODY(IUB1).
MOVE 'DB2PREPY' TO INSERT-TAIL(IUB1).
ADD 1 TO IUB1.
MOVE 'WS' TO INSERT-HDR(IUB1).
MOVE ' 01 SQL-ID PIC X(06) VALUE SPACES.'
TO INSERT-BODY(IUB1).
MOVE 'DB2PREPY' TO INSERT-TAIL(IUB1).
ADD 1 TO IUB1. MOVE 'WS' TO INSERT-HDR(IUB1). MOVE ' 01 WNF-ID PIC X(06) VALUE SPACES.' TO INSERT-BODY(IUB1). *** MOVE 'DB2PREPY' TO INSERT-TAIL(IUB1).
ADD 1 TO IUB1. MOVE 'WS' TO INSERT-HDR(IUB1). MOVE ' 01 WSE-ID PIC X(06) VALUE SPACES.' TO INSERT-BODY(IUB1). *** MOVE 'DB2PREPY' TO INSERT-TAIL(IUB1).
ADD 1 TO IUB1. MOVE 'WS' TO INSERT-HDR(IUB1). MOVE ' 01 WSW-ID PIC X(06) VALUE SPACES.' TO INSERT-BODY(IUB1). *** MOVE 'DB2PREPY' TO INSERT-TAIL(IUB1).
*** store the target db2 program into the-lines array
MOVE 0 TO LLUB1.
PERFORM
UNTIL LLUB1 > 999
OR END-OF-FILE-FLAG = 'Y'
ADD 1 TO LLUB1
MOVE IN-RECORD TO THE-LINE(LLUB1)
PERFORM READ-IN-FILE THRU RIFX
END-PERFORM.
IF END-OF-FILE-FLAG = 'N'
DISPLAY ER01
MOVE 16 TO RETURN-CODE
GO THEVERYEND
END-IF.
MOVE 1 TO LLUB2.
MOVE SPACES TO DUP-LINESS.
DUP-LOOP.
*** SCAN THE-LINE ARRAY FOR SIGNPOSTS
MOVE 'N' TO EXEC-SQL-FOUND.
PERFORM VARYING CUB1
FROM 8 BY 1
UNTIL CUB1 > 65
OR EXEC-SQL-FOUND = 'Y'
MOVE THE-LINE(LLUB2)(CUB1:9)
TO WS-CHARS
IF NINECHAR = ' EXEC SQL'
MOVE 'ES' TO DUP-LINE-CONTENTS(LLUB2)
*** DISPLAY LLUB2 'EXEC SQL FOUND' GO DUP-LOOP-PLUS END-IF END-PERFORM.
MOVE 'N' TO END-EXEC-FOUND.
PERFORM VARYING CUB1
FROM 8 BY 1
UNTIL CUB1 > 65
OR END-EXEC-FOUND = 'Y'
MOVE THE-LINE(LLUB2)(CUB1:9)
TO WS-CHARS
IF NINECHAR = ' END-EXEC'
MOVE 'EE' TO DUP-LINE-CONTENTS(LLUB2)
*** DISPLAY LLUB2 'END-EXEC FOUND' GO DUP-LOOP-PLUS END-IF END-PERFORM.
MOVE 'N' TO INCLUDE-FOUND.
PERFORM VARYING CUB1
FROM 8 BY 1
UNTIL CUB1 > 65
OR INCLUDE-FOUND = 'Y'
MOVE THE-LINE(LLUB2)(CUB1:7)
TO WS-CHARS
IF SEVENCHAR = 'INCLUDE'
MOVE 'IN' TO DUP-LINE-CONTENTS(LLUB2)
*** DISPLAY LLUB2 'INCLUDE FOUND' GO DUP-LOOP-PLUS END-IF END-PERFORM.
MOVE 'N' TO WORKING-STORAGE-FOUND.
PERFORM VARYING CUB1
FROM 8 BY 1
UNTIL CUB1 > 65
OR WORKING-STORAGE-FOUND = 'Y'
MOVE THE-LINE(LLUB2)(CUB1:15)
TO WS-CHARS
IF FIFTEENCHAR = 'WORKING-STORAGE'
MOVE 'WS' TO DUP-LINE-CONTENTS(LLUB2)
*** DISPLAY LLUB2 'WORKING-STORAGE FOUND' GO DUP-LOOP-PLUS END-IF END-PERFORM.
PERFORM VARYING CUB1
FROM 8 BY 1
UNTIL CUB1 > 65
OR PD-AT > 0
MOVE THE-LINE(LLUB2)(CUB1:18)
TO WS-CHARS
IF EIGHTEENCHAR = 'PROCEDURE DIVISION'
MOVE 'PD' TO DUP-LINE-CONTENTS(LLUB2)
*** DISPLAY LLUB2 'PROCEDURE DIVISION FOUND' MOVE LLUB2 TO PD-AT GO DUP-LOOP-PLUS END-IF END-PERFORM.
DUP-LOOP-PLUS.
ADD 1 TO LLUB2.
IF LLUB2 NOT > LLUB1
GO DUP-LOOP
END-IF.
MOVE 0 TO LLUB2.
SCAN-DUP-FOR-SQL.
ADD 1 TO LLUB2.
IF LLUB2 > LLUB1
GO THEND
END-IF.
IF DUP-LINE-CONTENTS(LLUB2) NOT = 'ES'
GO SCAN-DUP-FOR-SQL
END-IF.
PERFORM VARYING LLUB3
FROM LLUB2 BY 1
UNTIL LLUB3 > LLUB1
OR DUP-LINE-CONTENTS(LLUB3) = 'EE'
END-PERFORM.
IF LLUB3 > LLUB1
DISPLAY ER09
MOVE 16 TO RETURN-CODE
GO THEVERYEND
END-IF.
PERFORM VARYING LLUB4
FROM LLUB2 BY 1
UNTIL LLUB4 > LLUB3
DISPLAY 'LOOKING FOR INCLUDE '
LLUB4 DUP-LINE-CONTENTS(LLUB4)
PD-AT
IF DUP-LINE-CONTENTS(LLUB4) = 'IN' AND
LLUB4 < PD-AT
DISPLAY LLUB4 '<' PD-AT
PERFORM VARYING CUB1
FROM 8 BY 1
UNTIL CUB1 > 65
MOVE THE-LINE(LLUB4)(CUB1:7)
TO WS-CHARS
IF SEVENCHAR = 'INCLUDE'
*** DISPLAY 'INCLUDE@'CUB1
MOVE 'COPY '
TO THE-LINE(LLUB4)(CUB1:7)
MOVE '.'
TO THE-LINE(LLUB4)(71:1)
END-IF
END-PERFORM
ELSE
MOVE '*' TO THE-LINE(LLUB4)(7:1)
END-IF
END-PERFORM.
GO SCAN-DUP-FOR-SQL.
THEND.
IF RETURN-CODE = 0
INSERT THE EXTRA WS LINES AT THE BEGINNING OF THE WORKING STORAGE SECTION OF THE TARGET PROGRAM
PERFORM VARYING LLUB2
FROM 1 BY 1
UNTIL LLUB2 > LLUB1
IF LLUB2 > 1
MOVE THE-LINE (LLUB2 - 1)
(7:26)
TO TWENTYSIXCHAR
IF TWENTYSIXCHAR = ' WORKING-STORAGE SECTION.'
PERFORM VARYING IUB2
FROM 1 BY 1
UNTIL IUB2
> IUB1
MOVE INSERT-HDR (IUB2)
TO WS-CHARS
IF TWOCHAR = 'WS'
WRITE OUT-RECORD
FROM INSERTS (IUB2)
DISPLAY OUT-RECORD END-IF END-PERFORM END-IF END-IF WRITE OUT-RECORD FROM THE-LINE (LLUB2) DISPLAY OUT-RECORD END-PERFORM.
THEVERYEND.
PERFORM EOJ-ROUTINE THRU EX.
DISPLAY 'DB2PREPY ENDED WITH RC=' RETURN-CODE.
STOP RUN.
INITIALIZATION-ROUTINE.
OPEN INPUT IN-FILE.
OPEN OUTPUT OUT-FILE.
PERFORM READ-IN-FILE THRU RIFX.
IF END-OF-FILE-FLAG = 'Y'
DISPLAY 'INFILE IS EMPTY'
MOVE 16 TO RETURN-CODE
END-IF.
IRX. EXIT.
READ-IN-FILE.
READ IN-FILE
AT END
MOVE 'Y' TO END-OF-FILE-FLAG
GO RIFX
END-READ.
RIFX. EXIT.
EOJ-ROUTINE.
CLOSE IN-FILE.
CLOSE OUT-FILE.
EX. EXIT.
IDENTIFICATION DIVISION.
PROGRAM-ID. DB2PREPZ.
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT DATABASE-FILE
ASSIGN TO DATABASE
ORGANIZATION IS LINE SEQUENTIAL.
SELECT TARGET-FILE
ASSIGN TO CRE8TARG
ORGANIZATION IS LINE SEQUENTIAL.
SELECT INITIALS-FILE
ASSIGN TO CRE8INTS
ORGANIZATION IS LINE SEQUENTIAL.
SELECT PID-FILE
ASSIGN TO CRE8PID
ORGANIZATION IS LINE SEQUENTIAL.
SELECT CRE7BIN-FILE
ASSIGN TO CRE7BIN
ORGANIZATION IS LINE SEQUENTIAL.
SELECT CRE7SQL3-FILE
ASSIGN TO CRE7SQL3
ORGANIZATION IS LINE SEQUENTIAL.
SELECT ERR-FILE ASSIGN TO ERRFILE *** ORGANIZATION IS LINE SEQUENTIAL.
SELECT IN-FILE
ASSIGN TO INFILE
ORGANIZATION IS LINE SEQUENTIAL.
SELECT OUT-FILE
ASSIGN TO OUTFILE
ORGANIZATION IS LINE SEQUENTIAL.
SELECT SQL-FILE
ASSIGN TO SQLFILE
ORGANIZATION IS LINE SEQUENTIAL.
221122 SELECT ANOTHER-INTO-FILE 221122 ASSIGN TO ANOFILE 221122 ORGANIZATION IS LINE SEQUENTIAL.
221122 SELECT SQL-RESULT-FILE 221122 ASSIGN TO SQLRES 221122 ORGANIZATION IS LINE SEQUENTIAL.
221122 SELECT SQL-IN-FILE 221122 ASSIGN TO SQLIN 221122 ORGANIZATION IS LINE SEQUENTIAL.
DATA DIVISION.
FILE SECTION.
FD DATABASE-FILE
DATA RECORD IS DATABASE-RECORD.
01 DATABASE-RECORD PIC X(80).
FD TARGET-FILE
DATA RECORD IS TARGET-RECORD.
01 TARGET-RECORD PIC X(80).
FD INITIALS-FILE
DATA RECORD IS INITIALS-RECORD.
01 INITIALS-RECORD PIC X(80).
FD PID-FILE
DATA RECORD IS PID-RECORD.
01 PID-RECORD PIC X(80).
FD CRE7BIN-FILE
DATA RECORD IS CRE7BIN-RECORD.
01 CRE7BIN-RECORD.
03 CRE7BIN-1-TO-7 PIC X(07).
03 FILLER PIC X(73).
FD CRE7SQL3-FILE
DATA RECORD IS CRE7SQL3-RECORD.
01 CRE7SQL3-RECORD PIC X(80).
FD ERR-FILE DATA RECORD IS ERR-RECORD. ***01 ERR-RECORD PIC X(255).
FD IN-FILE
DATA RECORD IS IN-RECORD.
01 IN-RECORD.
03 IN-8 PIC X(08).
03 IN-REST PIC X(72).
FD OUT-FILE
DATA RECORD IS OUT-RECORD.
01 OUT-RECORD.
03 OUT-RECORD-1-6 PIC X(06).
03 OUT-RECORD-7-72 PIC X(66).
03 OUT-RECORD-73-80 PIC X(08).
221122 FD SQL-RESULT-FILE 221122 DATA RECORD IS SQL-RESULT-RECORD. 221122 01 SQL-RESULT-RECORD. 221122 03 SRR64. 221122 05 STR PIC X(21). 221122 05 PIC X(43). 221122 03 FILLER PIC X(65000).
FD SQL-FILE
DATA RECORD IS SQL-RECORD.
01 SQL-RECORD.
03 SQL-RECORD-1 PIC X(01).
03 SQL-RECORD-2-65 PIC X(64).
221122** THE DIFFICULTY I'VE BEEN HAVING TO GET MY HEAD AROUND 221122** COMES FROM THE IDEA THAT TO CREATE SOME OF THE FIELDS 221122** WITHIN THE ANO I NEED TO RETRIEVE VALUES FROM THE "INTO" 221122** ARRAY WHICH HOUSES ZCOBOL HOST VARIABLES, WHILST OTHER 221122** VALUES ARE TO COME FROM DB2 FIELDS WHICH ARE RETRIEVED 221122** VIA THE "DESCRIBE" AND THE ONLY WAY THAT I CAN MARRY 221122** THEM TOGETHER IS THAT THEY SHOULD MATCH POSITIONALLY. 221122** THUS THE FIRST FIELD OF THE "INTO" ARRAY SHOULD BE THE 221122** FIRSI FIELD FROM THE "DESCRIBE" AND SO ON. 221122* 221122 FD ANOTHER-INTO-FILE 221122 DATA RECORD IS ANO-RECORD. 221122 01 ANO-RECORD. 221122 03 ANO-LEFT PIC X(31). 221122 03 ANO-TYPE-LITERAL PIC X(14). 221122 03 ANO-LENGTH PIC X(06). 221122 03 ANO-RIGHT PIC X(31). 221122 03 ANO-SEQ-ID PIC X(06). *** HEREHEREHERE SEQ
221122 FD SQL-IN-FILE 221122 DATA RECORD IS SQL-IN-RECORD. 221122 01 SQL-IN-RECORD PIC X(65).
WORKING-STORAGE SECTION.
01 EOF-DATABASE PIC X(01).
01 EOF-CRE7BIN PIC X(01).
01 EOF-TARGET PIC X(01).
01 EOF-INITIALS PIC X(01).
01 EOF-PID PIC X(01).
221122** 01 LEFT-OR-RIGHT PIC X(01). 221122 01 LEFT-COUNT PIC 9(04) VALUE 0. 221122** HEREHEREHERE LEFT-OR-RIGHT AND LEFT-COUNT 221122** HEREHEREHERE BUT WHERE TO SET LEFT-COUNT TO ZERO???? 221122 221122 01 ANOTHER-INTO. 221122 03 ANOTHER-INTO-LEFT PIC X(31). 221122 03 ANOTHER-INTO-RIGHT PIC X(31). 221122 03 ANOTHER-SEQ-ID PIC X(06). *** HEREHEREHERE SEQ 221122 01 MAL-MATCH PIC X(01).
01 CALLED-PROG-NAME.
03 CPN-INITIALS PIC X(02).
03 CPN-PROG-ID PIC X(04).
03 CPN-SEQ-ID PIC 9(02).
01 FURST PIC X(01).
01 THIS-SQL PIC X(02) VALUE SPACES.
01 TWOQUOTES.
03 FILLER PIC X(01) VALUE ''''.
03 FILLER PIC X(01) VALUE ''''.
01 INSERT-SQL-DETAILSS.
03 INSERT-SQL-DETAILS OCCURS 99.
05 ISD-SQL-BLOCK PIC X(06).
05 ISD-THIS-SQL PIC X(02).
05 ISD-AFTER-LINE PIC 9(04).
05 ISD-HV-COUNT PIC 9(02).
05 ISD-HV-NAMESS.
07 ISD-HV-NAMES PIC X(32) OCCURS 9.
01 ISDUB1 PIC 9(04) COMP VALUE 0.
01 ISDUB2 PIC 9(04) COMP VALUE 0.
01 ISDUB3 PIC 9(04) COMP VALUE 0.
01 ISDHVUB1 PIC 9(04) COMP.
01 DYNAMIC-DISPLAYSS.
03 DYNAMIC-DISPLAYS OCCURS 24.
05 DYNAMIC-DISPLAY pic x(80).
01 DDUB1 PIC 9(04) COMP VALUE 0.
01 DDUB2 PIC 9(04) COMP VALUE 0.
01 PD-AT PIC 9(04) VALUE 0.
221122 01 COLUMN-INFO-FOUND PIC X(01) VALUE 'N'. 01 KOUNT2 PIC 9(04) VALUE 0.
221122 01 THE-SQL-INFOSS. 221122 03 THE-SQL-INFOS OCCURS 99. 221122 05 THE-SQL-TYPE PIC X(03). 221122 05 THE-SQL-TYPE-LITERAL pic x(14). 221122 05 THE-SQL-TYPE-LENGTH PIC X(06). 221122 05 THE-SQL-COLUMN-NAME PIC X(31). 221122 01 INFUB1 PIC S9(04) VALUE 0. 221122 01 INFUB2 PIC S9(04). 221122 01 THE-COLUMNSS. 03 THE-COLUMNS PIC X(52) OCCURS 99. 01 COLUB1 PIC 9(04). 01 COLUB2 PIC 9(04).
01 sqllump.
03 sqllump1 pic x(01).
03 sqllump2345 pic x(04).
01 nine04-zeroes pic 9(04) value zeroes.
01 FOUND-IT PIC X(01).
01 FOUND-ES PIC X(01).
01 FOWND PIC X(01).
01 THE-LINES.
03 THE-LINE PIC X(80) OCCURS 999.
01 LLUB1 PIC 9(04).
01 LLUB2 PIC 9(04).
01 LLUB3 PIC 9(04).
01 LLUB4 PIC 9(04).
01 LLUB5 PIC 9(04).
01 LLUB6 PIC 9(04).
01 LLUB7 PIC 9(04).
01 CUB1 PIC 9(04).
01 CUB2 PIC 9(04).
01 DUP-LINESS.
03 DUP-LINES OCCURS 999.
05 DUP-LINE-CONTENTS.
07 DUP-LINE-CONT-LL PIC X(02).
07 DUP-LINE-CONT-RR PIC 9(02).
01 SQL-LINESS.
03 SQL-LINES OCCURS 99.
05 SQL-LINE PIC X(65).
01 SQUB1 PIC 9(04) VALUE 0.
01 SQUB2 PIC 9(04) VALUE 0.
01 SQUB3 PIC 9(04) VALUE 0.
01 SQUB4 PIC 9(04) VALUE 0.
01 SQUB5 PIC 9(04) VALUE 0.
01 SQUB6 PIC 9(04) VALUE 0.
01 SQUB7 PIC 9(04) VALUE 0.
01 SQUB8 PIC 9(04) VALUE 0.
01 SQUB9 PIC 9(04) VALUE 0.
01 COPY-LINESS.
03 COPY-LINES OCCURS 99.
05 COPY-LINE.
07 COPY-LINE-BYTE PIC X(01)
OCCURS 65.
01 COMMENTZ.
03 FILLER PIC X(03) VALUE '-- '.
03 COMMENTZ-OFFSET PIC X(62).
01 IWH-LINESS.
03 IWH-LINES OCCURS 99.
05 IWH-LINE PIC X(65).
01 CLUB1 PIC 9(04) value 0.
01 CLUB2 PIC 9(04).
01 CLUB3 PIC 9(04).
01 CLUB4 PIC 9(04).
01 CLUB5 PIC 9(04).
01 CLUB6 PIC 9(04).
01 CLUB7 PIC 9(04).
01 CLUB8 PIC 9(04).
01 CLUB9 PIC 9(04).
01 CLUBT PIC 9(04).
01 CLUB97 PIC S9(04).
01 CLUB98 PIC S9(04).
01 CLUB99 PIC S9(04).
01 COUB1 PIC S9(04).
01 COUB2 PIC S9(04).
01 COUB3 PIC S9(04).
01 COUB4 PIC S9(04).
01 COUB5 PIC S9(04).
01 INTO-NAME PIC X(31).
01 INTO-ARRAYSS.
03 INTO-ARRAYS OCCURS 99.
05 INTO-SEQ-ID PIC X(06).
*** HEREHEREHERE SEQ 05 INTO-ARRAY PIC X(31).
01 INTUB1 PIC 9(04) VALUE 0.
01 INTUB2 PIC 9(04).
01 INTUB3 PIC 9(04).
01 CALL-ARRAYSS.
03 CALL-HEADER.
05 CALL-HEADER-1-TO-6 PIC X(06).
05 FILLER PIC X(09) VALUE SPACES.
05 FILLER PIC X(04) VALUE 'CALL'.
05 FILLER PIC X(01) VALUE SPACE.
05 FILLER PIC X(01) VALUE ''''.
05 CALL-PROG PIC X(08) VALUE SPACES.
05 FILLER PIC X(01) VALUE ''''.
05 FILLER PIC X(01) VALUE SPACE.
05 FILLER PIC X(05) VALUE 'USING'.
05 FILLER PIC X(36) VALUE SPACES.
05 FILLER PIC X(08) VALUE 'DB2PREPZ'.
03 CALL-BODY.
05 CALL-BODY-1-TO-6 PIC X(06).
05 CALL-BODY-FILLER1 PIC X(15).
05 CALL-BODY-INAME PIC X(31).
05 CALL-BODY-PUNC PIC X(01).
05 CALL-BODY-FILLER2 PIC X(19).
05 CALL-BODY-DB2PREPZ PIC X(08).
01 CAB1 PIC 9(04).
01 CAB2 PIC 9(04).
01 DEUX.
03 EIN PIC X(01).
03 ZWEI PIC X(01).
01 SQL-FLAGSS.
03 SQL-FLAGS OCCURS 99.
05 SQL-FLAG PIC X(65).
01 FLUB1 PIC 9(04).
01 FLUB2 PIC 9(04).
01 FUB1 PIC 9(04).
01 FUB2 PIC 9(04).
01 COPY-SPACES PIC X(01).
01 HOLD-FOUND PIC X(01) VALUE 'N'.
01 HOLD-AT PIC 9(04) VALUE 0.
01 THE-CURSORSS.
03 THE-CURSORS OCCURS 20.
05 THE-CURSOR PIC X(128).
01 CURB1 PIC 9(02) VALUE 0.
01 CURB2 PIC 9(02) VALUE 0.
01 CURB3 PIC 9(02) VALUE 0.
01 CURSOR-FOUND PIC X(01) VALUE 'N'.
221122 01 THE-DESCRIBESS. 221122 03 THE-DESCRIBES OCCURS 99. 221122 05 THE-DESCRIBE PIC X(65). 221122 221122 01 DESB1 PIC 9(03) VALUE 0. 221122 01 DESB2 PIC 9(03) VALUE 0. 221122 01 DESB3 PIC 9(03) VALUE 0. 221122 01 DESCRIBE-NOF-COLUMNS PIC 9(06). 221122 01 EOF-SQL-RESULT PIC X(01) VALUE 'N'.
01 EXEC-SQL-FOUND PIC X(01) VALUE 'N'.
01 END-EXEC-FOUND PIC X(01) VALUE 'N'.
01 INCLUDE-FOUND PIC X(01) VALUE 'N'.
01 WORKING-STORAGE-FOUND PIC X(01) VALUE 'N'.
01 WHENEVER-FOUND PIC X(01) VALUE 'N'.
01 SQL-TRUNC PIC X(60).
01 WNFSS. 03 WNFS OCCURS 10. 05 WNF-ID PIC X(06). 05 WNF-INSTR PIC X(50). 01 WNFUB1 PIC 9(04). 01 WNFUB2 PIC 9(04).
01 WSESS. 03 WSES OCCURS 10. 05 WSE-ID PIC X(06). 05 WSE-INSTR PIC X(50). 01 WSEUB1 PIC 9(04). 01 WSEUB2 PIC 9(04).
01 WSWSS. 03 WSWS OCCURS 10. 05 WSW-ID PIC X(06). 05 WSW-INSTR PIC X(50). 01 WSWUB1 PIC 9(04). 01 WSWUB2 PIC 9(04).
01 KWOTE PIC X(01) VALUE ''''.
01 INSERTSS.
03 INSERTS OCCURS 99.
05 INSERT-HDR PIC X(06).
05 INSERT-BODY PIC X(66).
05 INSERT-TAIL PIC X(08).
01 IUB1 PIC 9(04).
01 IUB2 PIC 9(04).
01 SQL-RECS.
03 SQL-REC OCCURS 20.
05 SQL-HDR PIC X(07).
05 SQL-STMT PIC X(2048).
01 SQLUB1 PIC 9(04) VALUE 0.
01 SQLUB2 PIC 9(04).
01 SQLCUB1 PIC 9(04).
01 FIFTY-BYTES PIC X(50).
01 EOF-IN PIC X VALUE 'F'.
01 SINGUL PIC X(01).
01 SQL-BUFFER1 PIC X(2048).
01 SQL-BUFFER2 PIC X(2048).
01 SQLSQL.
03 FILLER PIC X(03) VALUE 'SQL'.
03 SQL-COUNTER PIC 9(03) VALUE 0.
03 FILLER PIC X(01) VALUE '*'.
01 STOP-RUN-FOUND PIC X(01).
01 EXEC-FOUND PIC X(01).
01 SQL-FOUND PIC X(01).
01 END-X-FOUND PIC X(01).
01 ERROR-MSGS.
03 ER01 PIC X(70) VALUE
'DB2PREPZ - THE-LINE ARRAY MAXED OUT(999)'.
03 ER07 PIC X(70) VALUE
'DB2PREPZ - "EXEC"/"SQL" ERROR'.
03 ER08 PIC X(70) VALUE
'DB2PREPZ - "SQL"/"END-EXEC" ERROR'.
03 ER09 PIC X(70) VALUE
'DB2PREPZ - "EXEC"/"SQL"/"END-EXEC" MISMATCH'.
03 ER10 PIC X(70) VALUE
'DB2PREPZ - LOGIC ERROR'.
03 ER11 PIC X(70) VALUE
'DB2PREPZ - "FROM" NOT FOUND'.
01 SIXTYFOURCHAR PIC X(64).
01 THIRTYONECHAR PIC X(31).
01 TWENTYSIXCHAR PIC X(26).
01 PD-FLAG PIC X(01) VALUE 'N'.
01 PD-FOUND-AT PIC 9(04).
01 PD-FIRST PIC X(01) VALUE 'N'.
01 PARA-FIRST PIC X(01) VALUE 'N'.
01 WS-CHARS.
03 EIGHTEENCHAR PIC X(18).
03 FILLER REDEFINES EIGHTEENCHAR.
05 SEVENTEENCHAR PIC X(17).
05 FILLER PIC X(01).
03 FILLER REDEFINES EIGHTEENCHAR.
05 SIXTEENCHAR PIC X(16).
05 FILLER PIC X(02).
03 FILLER REDEFINES EIGHTEENCHAR.
05 FIFTEENCHAR PIC X(15).
05 FILLER PIC X(03).
03 FILLER REDEFINES EIGHTEENCHAR.
05 FOURTEENCHAR PIC X(14).
05 FILLER PIC X(04).
03 FILLER REDEFINES EIGHTEENCHAR.
05 THIRTEENCHAR PIC X(13).
05 FILLER PIC X(05).
03 FILLER REDEFINES EIGHTEENCHAR.
05 TWELVECHAR PIC X(12).
05 FILLER PIC X(06).
03 FILLER REDEFINES EIGHTEENCHAR.
05 ELEVENCHAR PIC X(11).
05 FILLER PIC X(07).
03 FILLER REDEFINES EIGHTEENCHAR.
05 TENCHAR PIC X(10).
05 FILLER PIC X(08).
03 FILLER REDEFINES EIGHTEENCHAR.
05 NINECHAR PIC X(09).
05 FILLER PIC X(09).
03 FILLER REDEFINES EIGHTEENCHAR.
05 EIGHTCHAR PIC X(08).
05 FILLER PIC X(10).
03 FILLER REDEFINES EIGHTEENCHAR.
05 SEVENCHAR PIC X(07).
05 FILLER PIC X(11).
03 FILLER REDEFINES EIGHTEENCHAR.
05 SIXCHAR PIC X(06).
05 FILLER PIC X(12).
03 FILLER REDEFINES EIGHTEENCHAR.
05 FIVECHAR PIC X(05).
05 FILLER PIC X(13).
03 FILLER REDEFINES EIGHTEENCHAR.
05 FOURCHAR PIC X(04).
05 FILLER PIC X(14).
03 FILLER REDEFINES EIGHTEENCHAR.
05 THREECHAR PIC X(03).
05 FILLER PIC X(15).
03 FILLER REDEFINES EIGHTEENCHAR.
05 TWOCHAR PIC X(02).
05 FILLER PIC X(16).
03 FILLER REDEFINES EIGHTEENCHAR.
05 ONECHAR PIC X(01).
05 FILLER PIC X(17).
01 THE-FIVECHAR.
03 syne pic x(01).
03 nine4 pic 9(04).
01 SIXCHAR2 PIC X(06).
01 DUMMY PIC X(1).
221122 01 nof-columns-found pic x(01).
221122 01 nof-columns-x.
221122 03 nof-columns pic 9(06).
01 SQL-ID PIC X(06).
221122 01 SQLCA.
221122 03 SQLCAID PIC X(8) VALUE X"0000000000000000".
221122 03 SQLCABC PIC S9(9) BINARY.
221122 03 SQLCODE PIC S9(9) BINARY.
221122 03 SQLERRM.
221122 49 SQLERRML PIC S9(4) BINARY.
221122 49 SQLERRMC PIC X(70).
221122 03 SQLERRP PIC X(8).
221122 03 SQLERRD OCCURS 6 TIMES
221122 PIC S9(9) BINARY.
221122 03 SQLWARN.
221122 05 SQLWARN0 PIC X.
221122 05 SQLWARN1 PIC X.
221122 05 SQLWARN2 PIC X.
221122 05 SQLWARN3 PIC X.
221122 05 SQLWARN4 PIC X.
221122 05 SQLWARN5 PIC X.
221122 05 SQLWARN6 PIC X.
221122 05 SQLWARN7 PIC X.
221122 05 SQLWARN8 PIC X.
221122 05 SQLWARN9 PIC X.
221122 05 SQLWARN10 PIC X.
221122 05 SQLWARNA
221122 REDEFINES
221122 SQLWARN10 PIC X.
221122 03 SQLSTATE PIC X(5).
01 kount pic 9(06).
01 rtcub1 pic S9(04).
01 rtcub2 pic S9(04).
01 rtcub3 pic S9(04).
01 rtcub4 pic S9(04).
01 ADUB1 PIC S9(04).
01 ADUB2 PIC S9(04).
01 ADUB3 PIC S9(04).
01 WSSS.
03 WSS OCCURS 100.
05 WS-DATA PIC X(31).
05 WS-LVL PIC X(02).
05 WS-ADDR.
07 WS-ADDR9 PIC 9(08).
05 WS-LEN.
07 WS-LEN9 PIC 9(08).
05 WS-PIC PIC X(08).
05 WS-PIC-TYP PIC X(01).
05 WS-PIC-SIGN PIC X(01).
05 WS-PIC-DEC PIC X(01).
01 hold-name pic x(31).
01 hold-start pic 9(08).
01 hold-len pic 9(08).
01 WSUB1 PIC 9(04).
01 WSUB2 PIC 9(04).
01 WSUB3 PIC 9(04).
01 WSUB4 PIC 9(04).
01 WSUB5 PIC 9(04).
01 WSCUB1 PIC 9(04).
01 WS-FIELD PIC X(31).
01 DIGIT-FOUND PIC X(01).
01 SAVE-ADDR PIC X(08).
01 SAVE-LEN PIC X(08).
01 ADDRESS-OF-EYECATCHER.
03 ADDRESS-OF-EYECATCHER9 PIC 9(08).
01 PRUB1 PIC S9(04).
01 PRUB2 PIC 9(04).
01 PRUB3 PIC 9(04).
01 PRUB4 PIC 9(04).
***01 ERR-FILE-ENDED-FLAG PIC X(01) VALUE 'N'. 01 EOF-SQL PIC X(01) VALUE 'N'.
01 STORESS.
03 STORES OCCURS 8.
05 STORE PIC X(32).
01 STUB1 PIC 9(04).
01 snine4 pic s9(04).
01 SPACE-FOUND PIC X(01).
221122 01 MATCH-FOUND PIC X(01).
LINKAGE SECTION.
PROCEDURE DIVISION.
MAINLINE.
DISPLAY '01 '. display 'O2 MAINLINE'. DISPLAY '03 ========'. DISPLAY '04 '.
PERFORM INITIALIZATION-ROUTINE THRU IRX.
IF RETURN-CODE NOT = 0
DISPLAY '05 DB2PREPZ - Error in Initialization'
MOVE 16 TO RETURN-CODE
GO THEVERYEND
END-IF.
store in an array the extra lines that are to appear at the start of the working storage of the target program
ADD 1 TO IUB1.
MOVE 'WS' TO INSERT-HDR(IUB1).
MOVE ' 01 EYECATCHER PIC X(02).'
TO INSERT-BODY(IUB1).
MOVE 'DB2PREPZ' TO INSERT-TAIL(IUB1).
ADD 1 TO IUB1.
MOVE 'WS' TO INSERT-HDR(IUB1).
MOVE ' 01 SQL-ID PIC X(06) VALUE SPACES.'
TO INSERT-BODY(IUB1).
MOVE 'DB2PREPZ' TO INSERT-TAIL(IUB1).
*** store the target db2 program into the-lines array
MOVE 0 TO LLUB1.
PERFORM
UNTIL LLUB1 > 999
OR EOF-IN = 'Y'
ADD 1 TO LLUB1
MOVE IN-RECORD TO THE-LINE(LLUB1)
PERFORM READ-IN-FILE THRU RIFX
END-PERFORM.
IF EOF-IN = 'N'
DISPLAY '06 ' ER01
MOVE 16 TO RETURN-CODE
GO THEVERYEND
END-IF.
MOVE 1 TO LLUB2.
MOVE SPACES TO DUP-LINESS.
PERFORM VARYING LLUB2
FROM 1 BY 1
UNTIL LLUB2 > LLUB1
*** SCAN THE-LINE ARRAY FOR SIGNPOSTS
MOVE 'N' TO FOUND-IT
IF FOUND-IT = 'N'
MOVE THE-LINE (LLUB2) (7:1) TO WS-CHARS
IF ONECHAR = '*'
OR ONECHAR = '-'
OR ONECHAR = 'D'
MOVE ONECHAR TO DUP-LINE-CONTENTS(LLUB2)
*** DISPLAY '07 ' LLUB2 '*, - OR D FOUND' MOVE 'Y' TO FOUND-IT END-IF END-IF
IF FOUND-IT = 'N'
MOVE THE-LINE(LLUB2)(8:18) TO WS-CHARS
IF EIGHTEENCHAR = 'PROCEDURE DIVISION'
MOVE 'PD' TO DUP-LINE-CONTENTS(LLUB2)
*** DISPLAY '08 ' LLUB2 'PROCEDURE DIVISION FOUND' MOVE LLUB2 TO PD-AT MOVE 'Y' TO FOUND-IT END-IF END-IF
IF FOUND-IT = 'N'
MOVE 'N' TO EXEC-SQL-FOUND
PERFORM VARYING CUB1
FROM 8 BY 1
UNTIL CUB1 > 65
OR EXEC-SQL-FOUND = 'Y'
MOVE THE-LINE(LLUB2)(CUB1:9)
TO WS-CHARS
IF NINECHAR = ' EXEC SQL' OR
NINECHAR = ' exec sql'
MOVE 'ES' TO DUP-LINE-CONTENTS(LLUB2)
*** DISPLAY '09 ' LLUB2 'EXEC SQL FOUND' MOVE 'Y' TO EXEC-SQL-FOUND END-IF END-PERFORM IF EXEC-SQL-FOUND = 'Y' MOVE 'Y' TO FOUND-IT END-IF END-IF
IF FOUND-IT = 'N'
MOVE 'N' TO END-EXEC-FOUND
PERFORM VARYING CUB1
FROM 8 BY 1
UNTIL CUB1 > 65
OR END-EXEC-FOUND = 'Y'
MOVE THE-LINE(LLUB2)(CUB1:9)
TO WS-CHARS
IF NINECHAR = ' END-EXEC' OR
NINECHAR = ' end-exec'
MOVE 'EE' TO DUP-LINE-CONTENTS(LLUB2)
*** DISPLAY '10 ' LLUB2 'END-EXEC FOUND' MOVE 'Y' TO END-EXEC-FOUND END-IF END-PERFORM IF END-EXEC-FOUND = 'Y' MOVE 'Y' TO FOUND-IT END-IF END-IF
IF FOUND-IT = 'N'
MOVE 'N' TO INCLUDE-FOUND
PERFORM VARYING CUB1
FROM 8 BY 1
UNTIL CUB1 > 65
OR INCLUDE-FOUND = 'Y'
MOVE THE-LINE(LLUB2)(CUB1:7)
TO WS-CHARS
IF SEVENCHAR = 'INCLUDE'
MOVE 'IN' TO DUP-LINE-CONTENTS(LLUB2)
*** DISPLAY '11 ' LLUB2 'INCLUDE FOUND' MOVE 'Y' TO INCLUDE-FOUND END-IF END-PERFORM IF INCLUDE-FOUND = 'Y' MOVE 'Y' TO FOUND-IT END-IF END-IF
IF FOUND-IT = 'N'
MOVE 'N' TO STOP-RUN-FOUND
PERFORM VARYING CUB1
FROM 12 BY 1
UNTIL CUB1 > 65
OR STOP-RUN-FOUND = 'Y'
MOVE THE-LINE(LLUB2)(CUB1:8)
TO WS-CHARS
IF EIGHTCHAR = 'STOP RUN'
MOVE 'SR' TO DUP-LINE-CONTENTS(LLUB2)
*** DISPLAY '12 ' LLUB2 'STOP RUN FOUND' MOVE 'Y' TO STOP-RUN-FOUND END-IF END-PERFORM IF STOP-RUN-FOUND = 'Y' MOVE 'Y' TO FOUND-IT END-IF END-IF
IF FOUND-IT = 'N'
MOVE 'N' TO WORKING-STORAGE-FOUND
PERFORM VARYING CUB1
FROM 8 BY 1
UNTIL CUB1 > 65
OR WORKING-STORAGE-FOUND = 'Y'
MOVE THE-LINE(LLUB2)(CUB1:15)
TO WS-CHARS
IF FIFTEENCHAR = 'WORKING-STORAGE'
MOVE 'WS' TO DUP-LINE-CONTENTS(LLUB2)
*** DISPLAY '13 ' LLUB2 'WORKING-STORAGE FOUND' MOVE 'Y' TO WORKING-STORAGE-FOUND END-IF END-PERFORM IF WORKING-STORAGE-FOUND = 'Y' MOVE 'Y' TO FOUND-IT END-IF END-IF
IF FOUND-IT = 'N'
MOVE 'N' TO WHENEVER-FOUND
PERFORM VARYING CUB1
FROM 8 BY 1
UNTIL CUB1 > 65
OR WHENEVER-FOUND = 'Y'
MOVE THE-LINE(LLUB2)(CUB1:8)
TO WS-CHARS
IF EIGHTCHAR = 'WHENEVER'
MOVE 'WH' TO DUP-LINE-CONTENTS(LLUB2)
*** DISPLAY '14 ' LLUB2 'WHENEVER FOUND' MOVE 'Y' TO WHENEVER-FOUND END-IF END-PERFORM IF WHENEVER-FOUND = 'Y' MOVE 'Y' TO FOUND-IT END-IF END-IF
DISPLAY '15 DUP-LINES(' LLUB2 ')=' DUP-LINE-CONTENTS (LLUB2) *** THE-LINE (LLUB2)
END-PERFORM.
PERFORM VARYING LLUB2
FROM 1 BY 1
UNTIL LLUB2 > LLUB1
MOVE 'N' TO FOUND-ES
IF FOUND-ES = 'N'
IF DUP-LINE-CONTENTS(LLUB2) = 'ES'
MOVE 'Y' TO FOUND-ES
END-IF
END-IF
IF FOUND-ES = 'Y'
PERFORM VARYING LLUB3
FROM LLUB2 BY 1
UNTIL LLUB3 > LLUB1
OR DUP-LINE-CONTENTS(LLUB3) = 'EE'
END-PERFORM
IF LLUB3 > LLUB1
DISPLAY '16 ' ER09
MOVE 16 TO RETURN-CODE
GO THEVERYEND
ELSE
ADD 1 LLUB2 GIVING LLUB4
SUBTRACT 1 FROM LLUB3
GIVING LLUB5
IF DUP-LINE-CONTENTS(LLUB4) = 'IN' AND
LLUB4 < PD-AT
PERFORM VARYING CUB1
FROM 8 BY 1
UNTIL CUB1 > 65
MOVE THE-LINE(LLUB4)(CUB1:7)
TO WS-CHARS
IF SEVENCHAR = 'INCLUDE'
MOVE 'COPY '
TO THE-LINE(LLUB4)(CUB1:7)
MOVE '.'
TO THE-LINE(LLUB4)(71:1)
MOVE ' '
TO THE-LINE(LLUB4)(7:1)
MOVE '*'
TO THE-LINE(LLUB2)(7:1)
MOVE '*'
TO THE-LINE(LLUB3)(7:1)
END-IF
END-PERFORM
ELSE
MOVE '*' TO THE-LINE(LLUB4)(7:1)
END-IF
IF DUP-LINE-CONTENTS(LLUB4) = 'WH'
PERFORM VARYING LLUB6
FROM LLUB2 BY 1
UNTIL LLUB6 > LLUB3
MOVE '*' TO THE-LINE (LLUB6)(7:1)
END-PERFORM
END-IF
IF LLUB4 > PD-AT AND
DUP-LINE-CONTENTS(LLUB4) NOT = 'WH'
ADD 1 TO SQL-COUNTER
PERFORM VARYING LLUB6
FROM LLUB2 BY 1
UNTIL LLUB6 > LLUB3
MOVE SQLSQL TO THE-LINE (LLUB6)
(1:7)
END-PERFORM
ADD 1 TO ISDUB1
MOVE SQLSQL TO ISD-SQL-BLOCK (ISDUB1)
MOVE SPACES TO ISD-THIS-SQL (ISDUB1)
MOVE LLUB3 TO ISD-AFTER-LINE(ISDUB1)
MOVE 0 TO ISD-HV-COUNT (ISDUB1)
MOVE SPACES TO ISD-HV-NAMESS (ISDUB1)
DISPLAY '19 ##############################' DISPLAY '19 ISDUB1=' ISDUB1 DISPLAY '20 ISD-SQL-BLOCK=' ISD-SQL-BLOCK (ISDUB1) DISPLAY '21 ISD-AFTER-LINE=' ISD-AFTER-LINE(ISDUB1) *** DISPLAY '22 B##############################'
MOVE SPACES TO SQL-FLAGSS
MOVE 'N' TO COPY-SPACES
PERFORM DO-THE-SQL THRU DTSX
DISPLAY '23 ' DISPLAY '24 CLUB1=' CLUB1 DISPLAY '25 ' PERFORM SIGNPOSTING THRU SPX HEREHEREHERE AND THIS IS WITHIN THE MAINLINE DISPLAY '26 ' DISPLAY '27 CLUB1=' CLUB1 DISPLAY '28 ' DISPLAY '29 WRITING SQL-RECORD ' 'FOR LLUB4 ' LLUB4 DUP-LINE-CONTENTS(LLUB4) WRISQL WRITE SQL-RECORD FROM SQLSQL DISPLAY '30 WRITING SQL-RECORD ' 'CLUB2=0' SQL-RECORD WRISQL PERFORM VARYING CLUB2 FROM 1 BY 1 UNTIL CLUB2 > CLUB1 IF COPY-LINE (CLUB2) NOT = SPACES WRITE SQL-RECORD FROM COPY-LINE (CLUB2) DISPLAY '31 WRITING SQL-RECORD ' 'CLUB2=' CLUB2 SQL-RECORD IF SQL-RECORD-1 = ':' DISPLAY '32 ===================' DISPLAY '33 COLON AT COLUMN 1' DISPLAY '34 LLUB3=' LLUB3 DISPLAY '35 THE-LINE(LLUB3)=' THE-LINE(LLUB3) DISPLAY '36 SQLSQL=' SQLSQL DISPLAY '37 SQL-RECORD=' SQL-RECORD DISPLAY '38 ===================' ADD 1 TO ISD-HV-COUNT(ISDUB1) MOVE ISD-HV-COUNT(ISDUB1) TO ISDHVUB1 MOVE SQL-RECORD-2-65 TO ISD-HV-NAMES (ISDUB1, ISDHVUB1) DISPLAY '39 ++++++++++++++++++++++' DISPLAY '40 ISD-HV-COUNT=' ISD-HV-COUNT(ISDUB1) DISPLAY '41 ISD-HV-NAMES=' ISD-HV-NAMES (ISDUB1, ISDHVUB1) DISPLAY '42 ++++++++++++++++++++++' END-IF ELSE DISPLAY '43 COPY-LINE ' CLUB2 ' IS SPACES' END-IF END-PERFORM
END-IF
END-IF
END-IF
END-PERFORM.
DISPLAY '44 '. display '45 END MAINLINE'. DISPLAY '46 ============'. DISPLAY '47 '.
THEND.
DISPLAY '48 '. display '49 THEND'. DISPLAY '50 ====='. DISPLAY '51 '.
IF RETURN-CODE = 0
IF ANY WHENEVER STATEMENTS OCCURRED IN THE TARGET PROGRAM COMMENT THEM OUT
*** PROCESS ALL OF THE-LINES FROM THE TARGET PROGRAM
PERFORM VARYING LLUB2
FROM 1 BY 1
UNTIL LLUB2 > LLUB1
IF DUP-LINE-CONTENTS(LLUB2) = 'SR'
MOVE SPACES TO OUT-RECORD
MOVE 'SQLZZZ MOVE ''FINIS'' TO SQL-ID.'
TO OUT-RECORD(1:35)
MOVE 'DB2PREPZ' TO OUT-RECORD (73:8)
WRITE OUT-RECORD
MOVE SPACES TO OUT-RECORD
MOVE 'SQLZZZ PERFORM SQL-IT THRU SQL-ITX.'
TO OUT-RECORD(1:40)
MOVE 'DB2PREPZ' TO OUT-RECORD (73:8)
WRITE OUT-RECORD
END-IF
IF LLUB2 = PD-FOUND-AT
MOVE 'Y' TO PD-FIRST
END-IF
INSERT THE EXTRA WS LINES AT THE BEGINNING OF THE WORKING STORAGE SECTION OF THE TARGET PROGRAM
MOVE THE-LINE (LLUB2 - 1)
(7:26)
TO TWENTYSIXCHAR
IF TWENTYSIXCHAR = ' WORKING-STORAGE SECTION.'
PERFORM VARYING IUB2
FROM 1 BY 1
UNTIL IUB2
> IUB1
MOVE INSERT-HDR (IUB2)
TO WS-CHARS
IF TWOCHAR = 'WS'
WRITE OUT-RECORD
FROM INSERTS (IUB2)
END-IF
END-PERFORM
END-IF
WRITE OUT-RECORD FROM THE-LINE (LLUB2)
INSERT THE EXTRA LINES AFTER EXEC SQL/END-EXEC CHUNKS IN THE PROCEDURE DIVISION OF THE TARGET PROGRAM
PERFORM VARYING ISDUB2
FROM 1 BY 1
UNTIL ISDUB2 > ISDUB1
OR LLUB2 = ISD-AFTER-LINE(ISDUB2)
END-PERFORM
IF LLUB2 = ISD-AFTER-LINE(ISDUB2)
MOVE ISD-HV-COUNT (ISDUB2) TO ISDHVUB1
IF ISDHVUB1 = 0
MOVE ISD-SQL-BLOCK (ISDUB2)
TO DYNAMIC-DISPLAY (1)(1:6)
MOVE SPACES
TO DYNAMIC-DISPLAY (1)(7:5)
MOVE 'DISPLAY '
TO DYNAMIC-DISPLAY (1)(12:8)
MOVE '''DYNSTART empty'''
TO DYNAMIC-DISPLAY (1)(20:16)
MOVE SPACES
TO DYNAMIC-DISPLAY (1)(36:37)
MOVE 'DB2PREPZ'
TO DYNAMIC-DISPLAY (1)(73:8)
MOVE ISD-SQL-BLOCK (ISDUB2)
TO DYNAMIC-DISPLAY (2)(1:6)
MOVE SPACES
TO DYNAMIC-DISPLAY (2)(7:5)
MOVE 'DISPLAY '
TO DYNAMIC-DISPLAY (2)(12:8)
MOVE '''DYNENDED empty'''
TO DYNAMIC-DISPLAY (2)(20:16)
MOVE SPACES
TO DYNAMIC-DISPLAY (2)(36:37)
MOVE 'DB2PREPZ'
TO DYNAMIC-DISPLAY (2)(73:8)
WRITE OUT-RECORD
FROM DYNAMIC-DISPLAYS(1)
WRITE OUT-RECORD
FROM DYNAMIC-DISPLAYS(2)
END-IF
IF ISDHVUB1 = 1
MOVE ISD-SQL-BLOCK (ISDUB2)
TO DYNAMIC-DISPLAY (1)(1:6)
MOVE SPACES
TO DYNAMIC-DISPLAY (1)(7:5)
MOVE 'DISPLAY '
TO DYNAMIC-DISPLAY (1)(12:8)
MOVE '''DYNSTART'' '
TO DYNAMIC-DISPLAY (1)(20:11)
MOVE ISD-HV-NAMES (ISDUB2, 1)
TO DYNAMIC-DISPLAY (1)(31:32)
MOVE SPACES
TO DYNAMIC-DISPLAY (1)(63:10)
MOVE 'DB2PREPZ'
TO DYNAMIC-DISPLAY (1)(73:8)
MOVE ISD-SQL-BLOCK (ISDUB2)
TO DYNAMIC-DISPLAY (2)(1:6)
MOVE SPACES
TO DYNAMIC-DISPLAY (2)(7:5)
MOVE 'DISPLAY '
TO DYNAMIC-DISPLAY (2)(12:8)
MOVE '''DYNENDED empty'''
TO DYNAMIC-DISPLAY (2)(20:16)
MOVE SPACES
TO DYNAMIC-DISPLAY (2)(36:37)
MOVE 'DB2PREPZ'
TO DYNAMIC-DISPLAY (2)(73:8)
WRITE OUT-RECORD
FROM DYNAMIC-DISPLAYS(1)
WRITE OUT-RECORD
FROM DYNAMIC-DISPLAYS(2)
END-IF
IF ISDHVUB1 = 2
MOVE ISD-SQL-BLOCK (ISDUB2)
TO DYNAMIC-DISPLAY(1)(1:6)
MOVE SPACES
TO DYNAMIC-DISPLAY(1)(7:5)
MOVE 'DISPLAY '
TO DYNAMIC-DISPLAY(1)(12:8)
MOVE '''DYNSTART'' '
TO DYNAMIC-DISPLAY(1)(20:11)
MOVE ISD-HV-NAMES (ISDUB2, 1)
TO DYNAMIC-DISPLAY(1)(31:32)
MOVE SPACES
TO DYNAMIC-DISPLAY(1)(63:10)
MOVE 'DB2PREPZ'
TO DYNAMIC-DISPLAY(1)(73:8)
MOVE ISD-SQL-BLOCK (ISDUB2)
TO DYNAMIC-DISPLAY(2)(1:6)
MOVE SPACES
TO DYNAMIC-DISPLAY(2)(7:5)
MOVE 'DISPLAY '
TO DYNAMIC-DISPLAY(2)(12:8)
MOVE '''DYNENDED'' '
TO DYNAMIC-DISPLAY(2)(20:11)
MOVE ISD-HV-NAMES (ISDUB2, 2)
TO DYNAMIC-DISPLAY(2)(31:32)
MOVE SPACES
TO DYNAMIC-DISPLAY(2)(63:10)
MOVE 'DB2PREPZ'
TO DYNAMIC-DISPLAY(2)(73:8)
WRITE OUT-RECORD
FROM DYNAMIC-DISPLAYS(1)
WRITE OUT-RECORD
FROM DYNAMIC-DISPLAYS(2)
END-IF
IF ISDHVUB1 > 2
MOVE ISD-SQL-BLOCK (ISDUB2)
TO DYNAMIC-DISPLAY(1)(1:6)
MOVE SPACES
TO DYNAMIC-DISPLAY(1)(7:5)
MOVE 'DISPLAY '
TO DYNAMIC-DISPLAY(1)(12:8)
MOVE '''DYNSTART'' '
TO DYNAMIC-DISPLAY(1)(20:11)
MOVE ISD-HV-NAMES (ISDUB2, 1)
TO DYNAMIC-DISPLAY(1)(31:32)
MOVE SPACES
TO DYNAMIC-DISPLAY(1)(63:10)
MOVE 'DB2PREPZ'
TO DYNAMIC-DISPLAY(1)(73:8)
MOVE ISD-SQL-BLOCK (ISDUB2)
TO DYNAMIC-DISPLAY(2)(1:6)
MOVE SPACES
TO DYNAMIC-DISPLAY(2)(7:5)
MOVE 'DISPLAY '
TO DYNAMIC-DISPLAY(2)(12:8)
MOVE '''DYNMIDDL'' '
TO DYNAMIC-DISPLAY(2)(20:11)
MOVE ISD-HV-NAMES (ISDUB2, 2)
TO DYNAMIC-DISPLAY(2)(31:32)
MOVE SPACES
TO DYNAMIC-DISPLAY(2)(63:10)
MOVE 'DB2PREPZ'
TO DYNAMIC-DISPLAY(2)(73:8)
WRITE OUT-RECORD
FROM DYNAMIC-DISPLAYS(1)
WRITE OUT-RECORD
FROM DYNAMIC-DISPLAYS(2)
PERFORM VARYING ISDUB3
FROM 3
BY 1
UNTIL ISDUB3 = ISDHVUB1
MOVE ISD-SQL-BLOCK (ISDUB2)
TO DYNAMIC-DISPLAY(ISDUB3)(1:6)
MOVE SPACES
TO DYNAMIC-DISPLAY(ISDUB3)(7:5)
MOVE 'DISPLAY '
TO DYNAMIC-DISPLAY(ISDUB3)(12:8)
MOVE '''DYNMIDDL'' '
TO DYNAMIC-DISPLAY(ISDUB3)(20:11)
MOVE ISD-HV-NAMES (ISDUB2, ISDUB3)
TO DYNAMIC-DISPLAY(ISDUB3)(31:32)
MOVE SPACES
TO DYNAMIC-DISPLAY(ISDUB3)(63:10)
MOVE 'DB2PREPZ'
TO DYNAMIC-DISPLAY(ISDUB3)(73:8)
WRITE OUT-RECORD
FROM DYNAMIC-DISPLAYS(ISDUB3)
END-PERFORM
ADD 1 TO ISDUB3
MOVE ISD-SQL-BLOCK (ISDUB2)
TO DYNAMIC-DISPLAY(ISDUB3)(1:6)
MOVE SPACES
TO DYNAMIC-DISPLAY(ISDUB3)(7:5)
MOVE 'DISPLAY '
TO DYNAMIC-DISPLAY(ISDUB3)(12:8)
MOVE '''DYNENDED'' '
TO DYNAMIC-DISPLAY(ISDUB3)(20:11)
MOVE ISD-HV-NAMES (ISDUB2, ISDUB3)
TO DYNAMIC-DISPLAY(ISDUB3)(31:32)
MOVE SPACES
TO DYNAMIC-DISPLAY(ISDUB3)(63:10)
MOVE 'DB2PREPZ'
TO DYNAMIC-DISPLAY(ISDUB3)(73:8)
WRITE OUT-RECORD
FROM DYNAMIC-DISPLAYS(ISDUB3)
END-IF
MOVE ISD-SQL-BLOCK (ISDUB2)
TO DYNAMIC-DISPLAY(1)(1:6)
MOVE SPACES
TO DYNAMIC-DISPLAY(1)(7:5)
MOVE 'MOVE '''
TO DYNAMIC-DISPLAY(1)(12:6)
MOVE ISD-SQL-BLOCK (ISDUB2)
TO DYNAMIC-DISPLAY(1)(18:6)
MOVE ''''
TO DYNAMIC-DISPLAY(1)(24:1)
MOVE ' TO SQL-ID'
TO DYNAMIC-DISPLAY(1)(25:10)
MOVE SPACES
TO DYNAMIC-DISPLAY(1)(35:38)
MOVE 'DB2PREPZ'
TO DYNAMIC-DISPLAY(1)(73:8)
MOVE ISD-SQL-BLOCK (ISDUB2)
TO DYNAMIC-DISPLAY(2)(1:6)
MOVE SPACES
TO DYNAMIC-DISPLAY(2)(7:5)
MOVE 'PERFORM SQL-IT THRU SQL-ITX'
TO DYNAMIC-DISPLAY(2)(12:27)
MOVE SPACES
TO DYNAMIC-DISPLAY(2)(39:34)
MOVE 'DB2PREPZ'
TO DYNAMIC-DISPLAY(2)(73:8)
WRITE OUT-RECORD
FROM DYNAMIC-DISPLAYS(1)
WRITE OUT-RECORD
FROM DYNAMIC-DISPLAYS(2)
IF ISD-THIS-SQL(ISDUB2) = 'SI'
OR ISD-THIS-SQL(ISDUB2) = 'FC'
* DISPLAY '***' 'INTUB1' INTUB1 DISPLAY '**' 'ISDUB2' ISDUB2 'ISD-SQL-BLOCK(ISDUB2)' ISD-SQL-BLOCK(ISDUB2) MOVE 'Y' TO FURST PERFORM VARYING INTUB2 FROM 1 BY 1 UNTIL INTUB2 > INTUB1 * DISPLAY '***' 'INTUB1' INTUB1 'INTUB2' INTUB2 'INTO-SEQ-ID(INTUB2)' INTO-SEQ-ID(INTUB2) IF ISD-SQL-BLOCK (ISDUB2) = INTO-SEQ-ID (INTUB2) * DISPLAY '***' 'EQUAL' 'INTUB2' INTUB2 IF FURST = 'Y' * DISPLAY '***' 'FURST' 'INTUB2' INTUB2 MOVE 'N' TO FURST *** [F SQLCODE NOT < 0 MOVE SPACE TO OUT-RECORD MOVE 'IF SQLCODE NOT < 0' TO OUT-RECORD(12:18) WRITE OUT-RECORD
MOVE SPACE TO OUT-RECORD
MOVE 'AND SQLCODE NOT = +100'
TO OUT-RECORD(12:22)
WRITE OUT-RECORD
MOVE ISD-SQL-BLOCK(ISDUB2)(5:2)
TO CPN-SEQ-ID
MOVE CALLED-PROG-NAME
TO CALL-PROG
MOVE ISD-SQL-BLOCK(ISDUB2)
TO CALL-HEADER-1-TO-6
WRITE OUT-RECORD
FROM CALL-HEADER
END-IF
MOVE ISD-SQL-BLOCK(ISDUB2)
TO CALL-HEADER-1-TO-6
MOVE ISD-SQL-BLOCK(ISDUB2)
TO CALL-BODY-1-TO-6
MOVE SPACES
TO CALL-BODY-FILLER1
MOVE INTO-ARRAY(INTUB2)
TO CALL-BODY-INAME
COMPUTE INTUB3 = INTUB2 + 1
IF INTO-SEQ-ID(INTUB2)
=
INTO-SEQ-ID(INTUB3)
MOVE ',' TO CALL-BODY-PUNC
ELSE
MOVE ' ' TO CALL-BODY-PUNC
END-IF
MOVE SPACES
TO CALL-BODY-FILLER2
MOVE 'DB2PREPZ'
TO CALL-BODY-DB2PREPZ
WRITE OUT-RECORD
FROM CALL-BODY
END-IF
END-PERFORM
*** END-IF
MOVE SPACES TO OUT-RECORD
MOVE 'END-IF' TO OUT-RECORD(12:6)
WRITE OUT-RECORD
PERFORM CRE7 THRU C7X
* DISPLAY '***'
*** DISPLAY ' '
END-IF
END-IF
END-PERFORM
END-IF.
*** END OF PROCESSING ALL THE-LINES OF THE TARGET PROGRAM
*** PUT THE EXTRA LINES OF CODE AT THE END OF THE TARGET PROGRAM
MOVE SPACES TO OUT-RECORD.
MOVE 'SQLZZZ SQL-IT.' TO OUT-RECORD(1:14).
MOVE 'DB2PREPZ' TO OUT-RECORD (73:8).
WRITE OUT-RECORD.
MOVE SPACES TO OUT-RECORD.
MOVE 'SQLZZZ CALL ' TO OUT-RECORD(1:16).
MOVE KWOTE TO OUT-RECORD (17:1).
MOVE 'SQUELCH5' TO OUT-RECORD (18:8).
MOVE KWOTE TO OUT-RECORD (26:1).
MOVE ' USING SQL-ID, SQLCA,' TO OUT-RECORD (27:21).
MOVE 'DB2PREPZ' TO OUT-RECORD (73:8).
WRITE OUT-RECORD.
MOVE SPACES TO OUT-RECORD.
MOVE 'SQLZZZ EYECATCHER.'
TO OUT-RECORD(1:42).
MOVE 'DB2PREPZ' TO OUT-RECORD (73:8).
WRITE OUT-RECORD.
MOVE SPACES TO OUT-RECORD.
MOVE 'SQLZZZ SQL-ITX. EXIT.' TO OUT-RECORD(1:21).
MOVE 'DB2PREPZ' TO OUT-RECORD (73:8).
WRITE OUT-RECORD.
*** END OF CODE FOR RETURN CODE OF 0 AFTER 'THEND' ENCOUNTERED
DISPLAY '52 '. display '53 END THEND'. DISPLAY '54 ========='. DISPLAY '55 '.
THEVERYEND.
DISPLAY '56 '. display '57 THEVERYEND'. DISPLAY '58 =========='. DISPLAY '59 '.
PERFORM EOJ-ROUTINE THRU EX.
DISPLAY '60 DB2PREPZ ENDED WITH RC=' RETURN-CODE.
DISPLAY '61 '. display '62 END THEVERYEND'. DISPLAY '63 =============='. DISPLAY '64 '.
STOP RUN.
SIGNPOSTING.
*** HEREHEREHERE IS PERFORMED BY MAINLINE
DISPLAY '100 '. display '101 SIGNPOSTING'. DISPLAY '102 ==========='. DISPLAY '103 '.
*** SIGNPOST SQL CURSOR
IF COPY-LINE(1) = 'DECLARE' AND
COPY-LINE(3) = 'CURSOR'
*** DISPLAY 'DC'
MOVE 'DC' TO DUP-LINE-CONT-LL(LLUB4)
MOVE 'DC' TO ISD-THIS-SQL (ISDUB1)
PERFORM MATCH-CURSOR THRU MCX
MOVE CURB2 TO DUP-LINE-CONT-RR(LLUB4)
MOVE 'N' TO HOLD-FOUND
MOVE 0 TO HOLD-AT
PERFORM VARYING CLUB2
FROM 1 BY 1
UNTIL CLUB2 > CLUB1
OR COPY-LINE(CLUB2) = 'FOR'
IF COPY-LINE(CLUB2) = 'HOLD'
MOVE 'Y' TO HOLD-FOUND
MOVE CLUB2 TO HOLD-AT
END-IF
END-PERFORM
IF HOLD-FOUND = 'Y'
IF COPY-LINE(HOLD-AT - 1) = 'WITHOUT'
MOVE 'WITH' TO COPY-LINE (HOLD-AT - 1)
ELSE
IF COPY-LINE(HOLD-AT - 1) = 'WITH'
MOVE DUMMY TO DUMMY
ELSE
DISPLAY '104 DB2PREPZ - DECLARE '
COPY-LINE(2)
' CURSOR - HOLD NOT PRECEDED '
' BY WITH OR WITHOUT'
MOVE 16 TO RETURN-CODE
GO THEVERYEND
END-IF
END-IF
ELSE
HOLD NOT FOUND, SO FOR/WITH/WITHOUT ARE DELIMITERS, BEFORE WHICH THE WITH HOLD SHOULD BE INSERTED
221122 PERFORM INSERT-WITH-HOLD THRU IWHX
221122 END-IF
PERFORM VARYING CLUB2
FROM 1 BY 1
UNTIL CLUB2 > CLUB1
OR COPY-LINE(CLUB2) = 'SELECT'
END-PERFORM
IF COPY-LINE(CLUB2) = 'SELECT'
PERFORM VARYING CLUB3
FROM CLUB2 BY 1
UNTIL CLUB3 > CLUB1
OR COPY-LINE(CLUB3) = 'WHERE'
END-PERFORM
IF COPY-LINE(CLUB3) = 'WHERE'
MOVE CLUB2 TO CLUB98
COMPUTE CLUB99 = CLUB3 - 1
MOVE 0 TO DESB1
PERFORM VARYING CLUB97
FROM CLUB98 BY 1
UNTIL CLUB97 > CLUB99
ADD 1 TO DESB1
MOVE COPY-LINE(CLUB97)
TO THE-DESCRIBE(DESB1)
END-PERFORM
END-IF
END-IF
END-IF
* THE FOLLOWING SEEMS TO BE DUPLICATED HEREHEREHERE **IF COPY-LINE(1) = 'SELECT' * PERFORM VARYING CLUB2 FROM 2 BY 1 UNTIL CLUB2 > CLUB1 OR COPY-LINE(CLUB2) = 'INTO' END-PERFORM IF COPY-LINE(CLUB2) = 'INTO' DISPLAY '109 SI' MOVE 'SI' TO DUP-LINE-CONT-LL(LLUB4) MOVE 'SI' TO ISD-THIS-SQL (ISDUB1) DISPLAY '109.5 ISDUB1' ISDUB1 PERFORM VARYING CLUB3 FROM CLUB2 BY 1 UNTIL CLUB3 > CLUB1 OR COPY-LINE(CLUB3) = 'FROM' END-PERFORM IF COPY-LINE(CLUB3) = 'FROM' DISPLAY '110 CLUB1=' CLUB1 COPY-LINE(CLUB1) 'CLUB2=' CLUB2 COPY-LINE(CLUB2) 'CLUB3=' CLUB3 COPY-LINE(CLUB3)
GET "SELECT FROM" FROM SELECT FOR DESCRIBE PERFORM DESCRIBEIT THRU DIX END-IF END-IF
IF COPY-LINE(1) = 'OPEN' AND
COPY-LINE(3) = 'CURSOR'
*** DISPLAY '107 OC' MOVE 'OC' TO DUP-LINE-CONT-LL(LLUB4) MOVE 'OC' TO ISD-THIS-SQL (ISDUB1) PERFORM MATCH-CURSOR THRU MCX MOVE CURB2 TO DUP-LINE-CONT-RR(LLUB4) END-IF
IF COPY-LINE(1) = 'CLOSE' AND
COPY-LINE(3) = 'CURSOR'
*** DISPLAY '108 CC' MOVE 'CC' TO DUP-LINE-CONT-LL(LLUB4) MOVE 'CC' TO ISD-THIS-SQL (ISDUB1) PERFORM MATCH-CURSOR THRU MCX MOVE CURB2 TO DUP-LINE-CONT-RR(LLUB4) END-IF
IF COPY-LINE(1) = 'SELECT'
PERFORM VARYING CLUB2
FROM 2 BY 1
UNTIL CLUB2 > CLUB1
OR COPY-LINE(CLUB2) = 'INTO'
END-PERFORM
IF COPY-LINE(CLUB2) = 'INTO'
'WHERE'
ADD 1 TO DESB1
MOVE COPY-LINE(CLUB97)
TO THE-DESCRIBE(DESB1)
END-PERFORM
221122 221122* GET "SELECT FROM" FROM SELECT FOR DESCRIBE 221122 PERFORM DESCRIBEIT THRU DIX HEREHEREHERE THIS TOO IS WITHIN SIGNPOSTING PERFORM SELECT-INTO-COMMENT THRU SICX HEREHEREHERE THIS IS WITHIN SELECT/INTO OF SIGNPOSTING PERFORM VARYING CLUBT FROM 1 BY 1 UNTIL CLUBT > CLUB1 IF COPY-LINE(CLUBT) = SPACES DISPLAY '112 COPY-LINE(CLUBT) ' CLUBT ' IS SPACES' ' - REDUCE CLUB1 BY 1' ADD -1 TO CLUB1 ELSE DISPLAY '111 CLUBT=' CLUBT *** COPY-LINE(CLUBT) END-IF END-PERFORM ELSE DISPLAY '113 DB2PREPZ - SELECT ' ' FROM NOT FOUND - PROGRAM LOGIC ERROR' MOVE 16 TO RETURN-CODE GO THEVERYEND END-IF
END-IF
END-IF
IF COPY-LINE(1) = 'FETCH'
PERFORM VARYING CLUB2
FROM 3 BY 1
UNTIL CLUB2 > CLUB1
OR COPY-LINE(CLUB2) = 'INTO'
END-PERFORM
IF COPY-LINE(CLUB2) = 'INTO'
DISPLAY '115 FC' MOVE 'FC' TO DUP-LINE-CONT-LL(LLUB4) MOVE 'FC' TO ISD-THIS-SQL(ISDUB1) PERFORM MATCH-CURSOR THRU MCX MOVE CURB2 TO DUP-LINE-CONT-RR(LLUB4) DISPLAY '115.5 ISDUB1' ISDUB1 MOVE CLUB1 TO CLUB3 herehe* the into clause could extend over several lines
GET "SELECT FROM" FROM DECLARE CURSOR FOR DESCRIBE 221122 PERFORM DESCRIBEIT THRU DIX HEREHEREHERE THIS IS WITHIN SIGNPOSTING
PERFORM FETCH-INTO-COMMENT THRU FICX
HEREHEREHERE AND THIS IS WITHIN FETCH/INTO OF SIGNPOSTING PERFORM VARYING CLUBT FROM 1 BY 1 UNTIL CLUBT > CLUB1 IF COPY-LINE(CLUBT) = SPACES DISPLAY '115.2 COPY-LINE(CLUBT) ' CLUBT ' IS SPACES' ' - REDUCE CLUB1 BY 1' ADD -1 TO CLUB1 ELSE DISPLAY '115.4 CLUBT=' CLUBT COPY-LINE(CLUBT) END-IF END-PERFORM END-IF END-IF
DISPLAY '116 '. display '117 END SIGNPOSTING'. DISPLAY '118 ==============='. DISPLAY '119 '.
SPX. EXIT.
CRE7.
DISPLAY ' '. display ' CRE7'. DISPLAY ' ===='. DISPLAY ' '.
READ CRE7BIN AND WRITE CRE7SQL3 UNTIL //01/// DETECTED WRITE 'DB2CRE8 II,PPPP,SS WHERE II IS CPN-INITIALS PPPP IS CPN-PROG-ID SS IS CPN-SEQ-ID *** AND THEN COPY THE REST
OPEN INPUT CRE7BIN-FILE.
MOVE 'N' TO EOF-CRE7BIN.
OPEN OUTPUT CRE7SQL3-FILE.
PERFORM READ-CRE7BIN THRU RC7BX.
CMD C has the effect of running the CMD in a new window and when the command finishes it terminates that window
MOVE SPACES TO CRE7SQL3-RECORD.
MOVE 'CMD /C' TO CRE7SQL3-RECORD(1:6).
MOVE 'DB2CRE8' TO CRE7SQL3-RECORD(8:8).
MOVE CPN-INITIALS TO CRE7SQL3-RECORD(18:2).
MOVE ',' TO CRE7SQL3-RECORD(20:1).
MOVE CPN-PROG-ID TO CRE7SQL3-RECORD(21:4).
MOVE ',' TO CRE7SQL3-RECORD(25:1).
MOVE CPN-SEQ-ID TO CRE7SQL3-RECORD(26:2).
MOVE ',' TO CRE7SQL3-RECORD(28:1).
MOVE TARGET-RECORD(1:8)
TO CRE7SQL3-RECORD(29:8).
DISPLAY 'CRE7SQL3-RECORD'
CRE7SQL3-RECORD.
WRITE CRE7SQL3-RECORD.
MOVE SPACES TO CRE7SQL3-RECORD.
MOVE 'CMD /C' TO CRE7SQL3-RECORD(1:6).
MOVE 'ZC390C ZCOBOL\DEMO\'
TO CRE7SQL3-RECORD(8:19).
MOVE CPN-INITIALS TO CRE7SQL3-RECORD(27:2).
MOVE CPN-PROG-ID TO CRE7SQL3-RECORD(29:4).
MOVE CPN-SEQ-ID TO CRE7SQL3-RECORD(33:2).
MOVE ',NOTIME' TO CRE7SQL3-RECORD(35:7).
DISPLAY 'CRE7SQL3-RECORD'
CRE7SQL3-RECORD.
WRITE CRE7SQL3-RECORD.
PERFORM READ-CRE7BIN THRU RC7BX.
CLOSE CRE7BIN-FILE.
CLOSE CRE7SQL3-FILE.
DISPLAY 'SUBMITTING' CRE7SQL3-RECORD.
DISPLAY ' '
DISPLAY ' '
DISPLAY ' '.
DISPLAY 'CALLING WREAD3'.
DISPLAY ' '.
CALL 'WREAD3'.
DISPLAY 'RETURNING FROM WREAD3'.
DISPLAY ' '.
DISPLAY ' '.
DISPLAY 'SUBMITTED ' CRE7SQL3-RECORD.
DISPLAY ' '. display ' END CRE7'. DISPLAY ' ========'. DISPLAY ' '.
C7X. EXIT.
READ-CRE7BIN.
READ-CRE7BIN-AGAIN.
READ CRE7BIN-FILE
AT END
MOVE 'Y' TO EOF-CRE7BIN
GO RC7BX
END-READ.
IF CRE7BIN-1-TO-7 = '//01///'
GO RC7BX
ELSE
WRITE CRE7SQL3-RECORD
FROM CRE7BIN-RECORD
GO READ-CRE7BIN-AGAIN
END-IF.
RC7BX. EXIT.
DO-THE-SQL.
DISPLAY '120 '. display '121 DO-THE-SQL'. DISPLAY '122 =========='. DISPLAY '123 '.
MOVE 0 TO SQUB1.
PERFORM VARYING LLUB6
FROM LLUB4 BY 1
UNTIL LLUB6 > LLUB5
ADD 1 TO SQUB1
MOVE THE-LINE(LLUB6)(8:65)
TO SQL-LINE(SQUB1)
END-PERFORM
END-PERFORM.
MOVE SPACES TO SQL-FLAGSS.
MOVE 'N' TO COPY-SPACES.
PERFORM FLAG-THE-SQL.
PERFORM SPLIT-SQL-INTO-COPY-LINES THRU SSICLX.
WRITE SQL-RECORD FROM SQLSQL PERFORM VARYING CLUB2 FROM 1 BY 1 UNTIL CLUB2 = CLUB1 WRITE SQL-RECORD FROM COPY-LINE (CLUB2) END-PERFORM.
DISPLAY '124 '. display '125 END DO-THE-SQL'. DISPLAY '126 =============='. DISPLAY '127 '.
DTSX. EXIT.
FLAG-THE-SQL.
DISPLAY '128 '. display '129 FLAG-THE-SQL'. DISPLAY '130 ============'. DISPLAY '131 '.
PERFORM VARYING SQUB2
FROM 1 BY 1
UNTIL SQUB2 > SQUB1
PERFORM VARYING CUB1
FROM 1 BY 1
UNTIL CUB1 > 65
MOVE SQL-LINE(SQUB2)(CUB1:2)
TO WS-CHARS
IF THREECHAR = TWOQUOTES
IF COPY-SPACES = 'Y'
MOVE 'X' TO SQL-FLAG(SQUB2)(CUB1:1)
ADD 1 TO CUB1
MOVE 'X' TO SQL-FLAG(SQUB2)(CUB1:1)
ADD 1 TO CUB1
ELSE
DISPLAY 'DB2PREPZ - triple quotes'
'not quoted'
MOVE 16 TO RETURN-CODE
END-IF
END-IF
MOVE SQL-LINE(SQUB2)(CUB1:1)
TO WS-CHARS
IF COPY-SPACES = 'Y'
MOVE 'X' TO SQL-FLAG(SQUB2)(CUB1:1)
ELSE
IF ONECHAR NOT = SPACES
MOVE 'X' TO SQL-FLAG(SQUB2)(CUB1:1)
END-IF
END-IF
IF ONECHAR = ''''
IF COPY-SPACES = 'Y'
MOVE 'N' TO COPY-SPACES
ELSE
MOVE 'Y' TO COPY-SPACES
END-IF
END-IF
END-PERFORM
DISPLAY '13101 ' DISPLAY '13102 ' SQUB2 DISPLAY '13103 ' SQL-LINE(SQUB2) DISPLAY '13104 ' SQL-FLAGS(SQUB2) END-PERFORM.
DISPLAY '132 '. display '133 END FLAG-THE-SQL'. DISPLAY '134 ================'. DISPLAY '135 '.
FTSX. EXIT.
SPLIT-SQL-INTO-COPY-LINES.
DISPLAY '136 '. display '137 SPLIT-SQL-INTO-COPY-LINES'. DISPLAY '138 ========================='. DISPLAY '139 '.
MOVE SPACES TO COPY-LINESS.
MOVE 1 TO CLUB1.
MOVE 0 TO COUB1.
PERFORM VARYING SQUB2
FROM 1 BY 1
UNTIL SQUB2 > SQUB1
PERFORM VARYING CUB1
FROM 1 BY 1
UNTIL CUB1 > 65
MOVE SPACES TO DEUX
MOVE SQL-FLAG(SQUB2)(CUB1:1)
TO WS-CHARS
MOVE ONECHAR TO EIN
ADD 1 TO CUB1 GIVING CUB2
MOVE SQL-FLAG(SQUB2)(CUB2:1)
TO WS-CHARS
MOVE ONECHAR TO ZWEI
IF DEUX = 'X '
MOVE SQL-LINE(SQUB2)(CUB1:1)
TO WS-CHARS
MOVE ONECHAR TO EIN
IF DEUX = ', '
ADD 1 TO CLUB1
MOVE ',' TO COPY-LINE(CLUB1)(1:1)
ADD 1 TO CLUB1
MOVE 0 TO COUB1
ELSE
ADD 1 TO COUB1
MOVE EIN TO COPY-LINE(CLUB1)(COUB1:1)
ADD 1 TO CLUB1
MOVE 0 TO COUB1
END-IF
ELSE
IF EIN = 'X'
ADD 1 TO COUB1
MOVE SQL-LINE(SQUB2)(CUB1:1)
TO COPY-LINE(CLUB1)(COUB1:1)
END-IF
END-IF
END-PERFORM
DISPLAY '139.998 SQUB2' SQUB2 'SQL-LINE(SQUB2) ' SQL-LINE(SQUB2)
END-PERFORM.
PERFORM VARYING CLUB99
FROM 1 BY 1
UNTIL CLUB99 > CLUB1
DISPLAY '139.999 CLUB99' CLUB99 'COPY-LINE(CLUB99)' COPY-LINE(CLUB99) END-PERFORM.
DISPLAY '140 '. display '141 END SPLIT-SQL-INTO-COPY-LINES - CLUB1=' CLUB1 ' COUB1=' COUB1 ';'. DISPLAY '142 ============================================='. *** DISPLAY '143 '.
SSICLX. EXIT.
MATCH-CURSOR.
DISPLAY '144 '. display '145 MATCH-CURSOR'. DISPLAY '146 ============'. DISPLAY '147 '.
PERFORM VARYING CURB2
FROM 1 BY 1
UNTIL CURB2 > CURB1
OR THE-CURSOR(CURB2)
=
COPY-LINE(2)
END-PERFORM.
IF THE-CURSOR(CURB2)
=
COPY-LINE(2)
MOVE DUMMY TO DUMMY
ELSE
ADD 1 TO CURB1
MOVE CURB1 TO CURB2
MOVE COPY-LINE(2)
TO THE-CURSOR(CURB1)
END-IF.
DISPLAY '148 '. display '149 END MATCH-CURSOR'. DISPLAY '150 ================'. DISPLAY '151 '.
MCX. EXIT.
INSERT-WITH-HOLD.
DISPLAY '152 '. display '153 INSERT-WITH-HOLD'. DISPLAY '154 ================'. DISPLAY '155 '.
MOVE CLUB2 TO CLUB4.
COMPUTE CLUB3 = CLUB2 - 1.
PERFORM VARYING CLUB5
FROM 1 BY 1
UNTIL CLUB5 > CLUB3
MOVE COPY-LINE(CLUB5) TO IWH-LINE(CLUB5)
*** DISPLAY '156 CLUB5=' CLUB5 IWH-LINE(CLUB5) END-PERFORM.
MOVE 'WITH' TO IWH-LINE(CLUB5).
*** DISPLAY '157 CLUB5(WITH)=' CLUB5 IWH-LINE(CLUB5)
ADD 1 TO CLUB5.
MOVE 'HOLD' TO IWH-LINE(CLUB5).
*** DISPLAY '158 CLUB5(HOLD)=' CLUB5 IWH-LINE(CLUB5)
ADD 1 TO CLUB5 GIVING CLUB6.
PERFORM VARYING CLUB7
FROM CLUB2 BY 1
UNTIL CLUB7 > CLUB1
IF COPY-LINE(CLUB7) = SPACES
**** DISPLAY ' COPY-LINE(CLUB7) ' CLUB7 ' IS SPACES' ELSE MOVE COPY-LINE(CLUB7) TO IWH-LINE(CLUB6) DISPLAY '159 CLUB6=' CLUB6 IWH-LINE(CLUB6) ADD 1 TO CLUB6 END-IF END-PERFORM. COMPUTE CLUB6 = CLUB6 - 1.
MOVE IWH-LINESS TO COPY-LINESS.
MOVE CLUB6 TO CLUB1
DISPLAY '160 '. display '161 END INSERT-WITH-HOLD'. DISPLAY '162 ===================='. DISPLAY '163 '.
IWHX. EXIT.
SELECT-INTO-COMMENT.
*** HEREHEREHERE THIS IS FOR SELECT/INTO
DISPLAY '164 '. display '165 SELECT-INTO-COMMENT'. DISPLAY '166 ==================='. DISPLAY '167 '.
CHANGE THE DB2 SQL COMMENT FROM / AND / TO -- AT THE START OF EACH LINE
*** MOVE '/* INTO' TO COPY-LINE(CLUB2).
*** SUBTRACT 1 FROM CLUB3.
PERFORM VARYING COUB1 FROM 65 BY -1 UNTIL COUB1 = 0 OR COPY-LINE-BYTE(CLUB3,COUB1) NOT = SPACE END-PERFORM. IF COPY-LINE-BYTE(CLUB3,COUB1) NOT = SPACE ADD 2 TO COUB1 MOVE '*' TO COPY-LINE-BYTE(CLUB3,COUB1) ADD 1 TO COUB1 MOVE '/' TO COPY-LINE-BYTE(CLUB3,COUB1) *** END-IF.
MOVE 0 TO INTUB1.
PERFORM VARYING CLUBT
FROM CLUB2 BY 1
UNTIL CLUBT = CLUB3
MOVE COPY-LINE(CLUBT)
TO COMMENTZ-OFFSET
MOVE COPY-LINE(CLUBT) TO WS-CHARS
221122 MOVE SPACES TO ANOTHER-INTO
IF FOURCHAR NOT = 'INTO'
IF ONECHAR NOT = ','
DISPLAY '167.5'
'CLUBT' CLUBT
'COPY-LINE(CLUBT)'
*** COPY-LINE(CLUBT)
PERFORM VARYING COUB1
FROM 65 BY -1
UNTIL COUB1 = 0
OR COPY-LINE-BYTE(CLUBT,COUB1)
NOT = SPACE
END-PERFORM
IF COUB1 = 0
DISPLAY '167.6 COUB1=0'
ELSE
DISPLAY '167.7 COUB1' COUB1
PERFORM VARYING COUB2
FROM 2 BY 1
UNTIL COUB2 > COUB1
OR COPY-LINE-BYTE(CLUBT,COUB2)
= ':'
END-PERFORM
IF COPY-LINE-BYTE(CLUBT,COUB2) = ':'
DISPLAY '167.8 COUB2' COUB2
ADD -2 COUB2 GIVING COUB3
MOVE COPY-LINE(CLUBT)(2:COUB3)
TO INTO-NAME
221122 MOVE INTO-NAME TO ANOTHER-INTO-LEFT
221122 DISPLAY '167.8.1 SI ANOTHER-INTO-LEFT'
*221122 ANOTHER-INTO-LEFT
221122** MOVE 'L' TO LEFT-OR-RIGHT
* HEREHEREHERE LEFT-OR-RIGHT=L
HEREHEREHERE INTO-ARRAY(INTUB1)
HEREHE============================================================*
HEREHE**
HEREHE** THIS IS WITHIN 'SELECT-INTO' 22/11/22 KAZAK
HEREHE**
HEREHE** IV - PERHAPS WE COULD STORE THE NAME OF THE FIELD
HEREHE** INTO AN IV ARRAY AND/OR A FILE, TO BE RETRIEVED
HEREHE** AND USED WHEN CREATING THE CALL TO THE CREATED
HEREHE** PROGRAM AS THE FIRST OF THE 'USING' LINKAGE
HEREHE** FIELDS BOTH IN THE CALL AND IN THE CALLED,
HEREHE** THIS IV ARRAY SHOULD INCLUDE THE SQL SEQ ID
HEREHE**
HEREHE** PROCESSING OF NULL FIELDS IN THE CREATED PROGRAM(S)
HEREHE** WOULD HAVE TO USE THESE NAMES EXPLICITLY TO GENERATE
HEREHE** THE CODE NECESSARY TO HANDLE EACH IV OCCURENCE.
HEREHE**
HEREHE** IV IS NOT REFERENCED EXPLICITLY ANYWHERE ELSE IN THIS
HEREHE** PROGRAM, IT IS IMPLIED BY THE USE OF THE SECOND COLON
HEREHE** IN AN 'INTO' LINE
HEREHE**
HEREHE** WE SHOULD REPLICATE THIS WITHIN THE CODE OF'FETCH-INTO'
HEREHE**
HEREHE============================================================
* DISPLAY '167.81'
'CLUBT' CLUBT
'COUB3' COUB3
'INTO-NAME' INTO-NAME
'ISDUB1' ISDUB1
'ISD-SQL-BLOCK(ISDUB1)'
ISD-SQL-BLOCK(ISDUB1)
ADD 1 TO INTUB1
HEREHEREHERE INTO-ARRAY(INTUB1)
MOVE INTO-NAME
TO INTO-ARRAY(INTUB1)
MOVE ISD-SQL-BLOCK(ISDUB1)
TO INTO-SEQ-ID(INTUB1)
HEREHEREHERE SEQ WITHIN SELECT-INTO-COMMENT
DISPLAY '167.85 INTO-NAME1' INTO-NAME
ADD 1 TO COUB2
ADD -COUB2 COUB1 1 GIVING COUB3
MOVE COPY-LINE(CLUBT)(COUB2:COUB3)
TO INTO-NAME
221122 MOVE INTO-NAME TO ANOTHER-INTO-RIGHT
221122 DISPLAY '167.85.1 SI ANOTHER-INTO-RIGHT'
*221122 ANOTHER-INTO-RIGHT
ADD 1 TO INTUB1
221122** MOVE 'R' TO LEFT-OR-RIGHT
* HEREHEREHERE LEFT-OR-RIGHT=R
HEREHEREHERE INTO-ARRAY(INTUB1)
MOVE INTO-NAME
TO INTO-ARRAY(INTUB1)
MOVE ISD-SQL-BLOCK(ISDUB1)
TO INTO-SEQ-ID(INTUB1)
HEREHEREHERE SEQ WITHIN SELECT-INTO-COMMENT
221122 MOVE ISD-SQL-BLOCK(ISDUB1)
221122 TO ANOTHER-SEQ-ID
HEREHEREHERE SEQ WITHIN SELECT-INTO-COMMENT
221122 PERFORM MATCH-ANO-LEFT-WITH-SQL-INFO
221122 THRU MALWSIX
HEREHEREHERE
221122 WRITE ANO-RECORD
HEREHEREHERE THIS IS WITHIN SELECT-INTO-COMMENT
221122 DISPLAY '167.85.2 WRITE SI ANO-RECORD'
ANO-RECORD
DISPLAY '167.86 INTO-NAME2' INTO-NAME
ELSE
DISPLAY ' 167.9 : NOT FOUND'
ADD -1 COUB2 GIVING COUB3
MOVE COPY-LINE(CLUBT)(2:COUB3)
TO INTO-NAME
221122 MOVE INTO-NAME TO ANOTHER-INTO-LEFT
221122 DISPLAY '167.9.0 SI ANOTHER-INTO-LEFT'
*221122 ANOTHER-INTO-LEFT
ADD 1 TO INTUB1
221122** MOVE 'L' TO LEFT-OR-RIGHT
* HEREHEREHERE LEFT-OR-RIGHT=L
HEREHEREHERE INTO-ARRAY(INTUB1)
MOVE INTO-NAME
TO INTO-ARRAY(INTUB1)
MOVE ISD-SQL-BLOCK(ISDUB1)
TO INTO-SEQ-ID(INTUB1)
HEREHEREHERE SEQ WITHIN SELECT-INTO-COMMENT
221122 MOVE ISD-SQL-BLOCK(ISDUB1)
221122 TO ANOTHER-SEQ-ID
HEREHEREHERE SEQ WITHIN SELECT-INTO-COMMENT
221122 PERFORM MATCH-ANO-LEFT-WITH-SQL-INFO
221122 THRU MALWSIX
HEREHEREHERE
221122 WRITE ANO-RECORD
HEREHEREHERE THIS IS WITHIN SELECT-INTO-COMMENT
221122 DISPLAY '167.9.1 WRITE SI ANO-RECORD'
ANO-RECORD
DISPLAY '167.95 INTO-NAME' INTO-NAME
END-IF
END-IF
END-IF
END-IF
HEREHE****
MOVE COMMENTZ
TO COPY-LINE(CLUBT)
DISPLAY '168 SELECT-INTO-COMMENT CLUBT=' CLUBT 'COPY-LINE=' COPY-LINE(CLUBT) END-PERFORM. PERFORM VARYING INTUB2 FROM 1 BY 1 UNTIL INTUB2
INTUB1 DISPLAY '167.99 INTUB2' INTUB2 'INTO-ARRAY(INTUB2)' INTO-ARRAY(INTUB2) 'INTO-SEQ-ID(INTUB2)' *** INTO-SEQ-ID(INTUB2) END-PERFORM.
DISPLAY '169 '. display '170 END SELECT-INTO-COMMENT'. DISPLAY '171 ======================='. DISPLAY '172 '.
SICX. EXIT.
FETCH-INTO-COMMENT.
*** HEREHEREHERE WRITE ANO-RECORD TIMES 2 AND FETCH-INTO-COMMENT IS PERFORMED BY SIGNPOSTING
DISPLAY '173 '. display '174 FETCH-INTO-COMMENT'. DISPLAY '175 =================='. DISPLAY '176 '.
DISPLAY '176.1 CLUB3' CLUB3 PERFORM VARYING CLUBT FROM CLUB2 BY 1 UNTIL CLUBT = CLUB3 MOVE COPY-LINE(CLUBT) TO COMMENTZ-OFFSET MOVE COPY-LINE(CLUBT) TO WS-CHARS DISPLAY '177.0 WS-CHARS' WS-CHARS 221122 MOVE SPACES TO ANOTHER-INTO IF FOURCHAR NOT = 'INTO' IF ONECHAR NOT = ',' CCCCCC DISPLAY '177.01' 'CLUBT' CLUBT 'COPY-LINE(CLUBT)' COPY-LINE(CLUBT)
PERFORM VARYING COUB1
FROM 65 BY -1
UNTIL COUB1 = 0
OR COPY-LINE-BYTE(CLUBT,COUB1)
NOT = SPACE
END-PERFORM
IF COUB1 = 0
CCCCCC DISPLAY '177.03 COUB1=0' ELSE CCCCCC DISPLAY '177.05 COUB1' COUB1 PERFORM VARYING COUB2 FROM 2 BY 1 UNTIL COUB2 > COUB1 OR COPY-LINE-BYTE(CLUBT,COUB2) = ':' END-PERFORM IF COPY-LINE-BYTE(CLUBT,COUB2) = ':' *CCCCCC DISPLAY '177.7 COUB2' COUB2 ADD -2 COUB2 GIVING COUB3 MOVE COPY-LINE(CLUBT)(2:COUB3) TO INTO-NAME 221122 MOVE INTO-NAME TO ANOTHER-INTO-LEFT 221122** MOVE 'L' TO LEFT-OR-RIGHT * HEREHEREHERE LEFT-OR-RIGHT=L HEREHEREHERE INTO-ARRAY(INTUB1) 221122 DISPLAY 'FI ANOTHER-INTO-LEFT' *221122 ANOTHER-INTO-LEFT HEREHE** IV *CCCCCC DISPLAY '177.9' 'CLUBT' CLUBT 'COUB3' COUB3 'INTO-NAME' INTO-NAME 'ISDUB1' ISDUB1 'ISD-SQL-BLOCK(ISDUB1)' ISD-SQL-BLOCK(ISDUB1) ADD 1 TO INTUB1 221122** MOVE 'L' TO LEFT-OR-RIGHT HEREHEREHERE LEFT-OR-RIGHT=L HEREHEREHERE INTO-ARRAY(INTUB1) MOVE INTO-NAME TO INTO-ARRAY(INTUB1) MOVE ISD-SQL-BLOCK(ISDUB1) TO INTO-SEQ-ID(INTUB1) *** HEREHEREHERE SEQ WITHIN FETCH-INTO-COMMENT
MOVE ISD-SQL-BLOCK(ISDUB1)
221122 TO ANOTHER-SEQ-ID
HEREHEREHERE SEQ WITHIN FETCH-INTO-COMMENT ???? MATCH-ANO. NO, IT'S BELOW.
CCCCCC DISPLAY '177.11 INTO-NAME1' INTO-NAME
ADD 1 TO COUB2
ADD -COUB2 COUB1 1 GIVING COUB3
MOVE COPY-LINE(CLUBT)(COUB2:COUB3)
TO INTO-NAME
221122 MOVE INTO-NAME TO ANOTHER-INTO-RIGHT
221122 DISPLAY '177.12 FI ANOTHER-INTO-RIGHT'
221122 ANOTHER-INTO-RIGHT
ADD 1 TO INTUB1
221122** MOVE 'R' TO LEFT-OR-RIGHT
HEREHEREHERE LEFT-OR-RIGHT=R
HEREHEREHERE INTO-ARRAY(INTUB1)
MOVE INTO-NAME
TO INTO-ARRAY(INTUB1)
MOVE ISD-SQL-BLOCK(ISDUB1)
TO INTO-SEQ-ID(INTUB1)
HEREHEREHERE SEQ WITHIN FETCH-INTO-COMMENT
221122 MOVE ISD-SQL-BLOCK(ISDUB1)
221122 TO ANOTHER-SEQ-ID
HEREHEREHERE SEQ WITHIN FETCH-INTO-COMMENT
221122 PERFORM MATCH-ANO-LEFT-WITH-SQL-INFO
221122 THRU MALWSIX
HEREHEREHERE WITHIN FETCH-INTO-COMMENT
221122 WRITE ANO-RECORD
HEREHEREHERE THIS IS WITHIN FETCH-INTO-COMMENT
221122 DISPLAY '177.12 WRITE SI ANO-RECORD'
ANO-RECORD
CCCCCC DISPLAY '177.13 INTO-NAME2' INTO-NAME
ELSE
CCCCCC DISPLAY ' 177.13 : NOT FOUND'
ADD -1 COUB2 GIVING COUB3
MOVE COPY-LINE(CLUBT)(2:COUB3)
TO INTO-NAME
221122 MOVE INTO-NAME TO ANOTHER-INTO-LEFT
221122 DISPLAY '177.14 FI ANOTHER-INTO-LEFT'
221122 ANOTHER-INTO-LEFT
ADD 1 TO INTUB1
221122** MOVE 'L' TO LEFT-OR-RIGHT
HEREHEREHERE LEFT-OR-RIGHT=L
HEREHEREHERE INTO-ARRAY(INTUB1)
MOVE INTO-NAME
TO INTO-ARRAY(INTUB1)
MOVE ISD-SQL-BLOCK(ISDUB1)
TO INTO-SEQ-ID(INTUB1)
HEREHEREHERE SEQ WITHIN FETCH-INTO-COMMENT
221122 MOVE ISD-SQL-BLOCK(ISDUB1)
221122 TO ANOTHER-SEQ-ID
HEREHEREHERE SEQ WITHIN FETCH-INTO-COMMENT
221122 PERFORM MATCH-ANO-LEFT-WITH-SQL-INFO
221122 THRU MALWSIX
HEREHEREHERE
221122 WRITE ANO-RECORD
HEREHEREHERE THIS TOO IS WITHIN FETCH-INTO-COMMENT
221122 DISPLAY '177.14.1 WRITE FI ANO-RECORD'
221122 ANO-RECORD
*CCCCCC DISPLAY '177.15 INTO-NAME' INTO-NAME
END-IF
END-IF
END-IF
END-IF
HEREHE***
MOVE COMMENTZ
TO COPY-LINE(CLUBT)
CCCCCC DISPLAY '177.17 FETCH-INTO-COMMENT CLUBT=' CLUBT
*** 'COPY-LINE(CLUBT)' COPY-LINE(CLUBT)
END-PERFORM.
PERFORM VARYING INTUB2
FROM 1 BY 1
UNTIL INTUB2
INTUB1 CCCCCC DISPLAY '177.19 FC INTUB2' INTUB2 'INTO-ARRAY(INTUB2)' INTO-ARRAY(INTUB2) 'INTO-SEQ-ID(INTUB2)' INTO-SEQ-ID(INTUB2) END-PERFORM. PERFORM VARYING CLUB2 FROM 3 BY 1 UNTIL CLUB2 > CLUB1 MOVE COPY-LINE(CLUB2) TO COMMENTZ-OFFSET MOVE COMMENTZ TO COPY-LINE(CLUB2) DISPLAY '177 FETCH-INTO-COMMENT CLUB2=' CLUB2 'COPY-LINE=' COPY-LINE(CLUB2) *** END-PERFORM.
DISPLAY '178 '. display '179 END FETCH-INTO-COMMENT'. DISPLAY '180 ======================'. DISPLAY '181 '.
FICX. EXIT.
221122 DESCRIBEIT. *** HEREHEREHERE
221122 DISPLAY ' '. 221122 display 'DESCRIBEIT'. 221122 DISPLAY '=========='. 221122 DISPLAY ' '.
221122 OPEN OUTPUT SQL-IN-FILE.
MOVE SPACES TO SQL-IN-RECORD.
221122 MOVE 'CONNECT TO ' TO SQL-IN-RECORD(1:11). MOVE DATABASE-RECORD(1:8) TO SQL-IN-RECORD(12:8). MOVE '~' TO SQL-IN-RECORD(20:1). 221122 WRITE SQL-IN-RECORD.
221122 MOVE 'DESCRIBE' TO SQL-IN-RECORD. 221122 WRITE SQL-IN-RECORD.
221122** PERFORM VARYING CLUB7 221122** FROM 1 BY 1 221122** UNTIL COPY-LINE(CLUB7) = 'SELECT' 221122** DISPLAY 'DESCRIBEIT + CLUB7' CLUB7 221122** 'COPY-LINE(CLUB7)' 221122** COPY-LINE(CLUB7) 221122** END-PERFORM.
221122** PERFORM VARYING CLUB8 221122** FROM CLUB7 BY 1 221122** UNTIL COPY-LINE(CLUB8) = 'WHERE' 221122** END-PERFORM.
221122 PERFORM VARYING DESB2 221122 FROM 1 BY 1 221122 UNTIL DESB2 > DESB1 221122 MOVE THE-DESCRIBE(DESB2) 221122 TO SQL-IN-RECORD 221122 WRITE SQL-IN-RECORD 221122 DISPLAY 'DESCRIBEIT - SQL-IN-RECORD' 221122 SQL-IN-RECORD 221122 END-PERFORM.
221122 MOVE '~' TO SQL-IN-RECORD. 221122 WRITE SQL-IN-RECORD.
221122 MOVE 'CONNECT RESET~' TO SQL-IN-RECORD. 221122 WRITE SQL-IN-RECORD.
221122 MOVE 'TERMINATE~' TO SQL-IN-RECORD. 221122 WRITE SQL-IN-RECORD.
221122 CLOSE SQL-IN-FILE.
DISPLAY 'INITIATING DESCRIBE PROCESS VIA CMDPROC 1'. DISPLAY 'START1 - DESCRIBE'. 221122 CALL 'START1'. DISPLAY 'WREAD1 - DESCRIBE'. 221122 CALL 'WREAD1'. DISPLAY 'STOP1 - DESCRIBE'. 221122 CALL 'STOP1'. *** DISPLAY 'FINISHING DESCRIBE PROCESS VIA CMDPROC 1'.
221122 OPEN INPUT SQL-RESULT-FILE. 221122 MOVE 'N' TO EOF-SQL-RESULT. 221122 PERFORM GET-SQLCODE THRU GSCX. 221122 CLOSE SQL-RESULT-FILE.
221122 OPEN INPUT SQL-RESULT-FILE. 221122 move 'N' to EOF-sql-RESULT. 221122 move 'N' to nof-columns-found 221122 move '000000' to nof-columns-x 221122 perform find-nof-columns thru fncx 221122 if nof-columns-found = 'Y' 221122 display 'DB2PREPZ - nof columns=' 221122 Nof-columns 221122 end-if 221122 CLOSE SQL-RESULT-FILE.
221122 OPEN INPUT SQL-RESULT-FILE. 221122 move 'N' to EOF-sql-RESULT. 221122 perform extract-column-info thru ecix *** HEREHEREHERE IN DESCRIBEIT 221122 CLOSE SQL-RESULT-FILE.
221122 DISPLAY ' '. 221122 display 'END DESCRIBEIT'. 221122 DISPLAY '=============='. 221122 DISPLAY ' '.
221122 DIX. EXIT.
221122 find-nof-columns.
221122 DISPLAY ' '. 221122 display 'FIND-NOF-COLUMNS'. 221122 DISPLAY '================'. 221122 DISPLAY ' '.
221122 perform varying kount from 1 by 1 until kount > 999
221122 or nof-columns-found = 'Y'
221122 PERFORM read-SQL-RESULT-file thru RSRFX
221122 if EOF-sql-RESULT = 'N'
221122 perform varying rtcub1 from 1 by 1
221122 until rtcub1 > 60
221122 or nof-columns-found = 'Y'
221122 move sql-RESULT-record (rtcub1:9)
221122 to ninechar
221122 if ninechar = 'columns: '
221122 move 'Y' to nof-columns-found
221122 end-if
221122 end-perform
221122 end-if
221122 end-perform.
221122 if nof-columns-found = 'Y'
221122 add 8 to rtcub1
221122 perform varying rtcub2 from rtcub1 by 1 221122 until rtcub2 > 59 221122 or sql-RESULT-record (rtcub2:1) = ' ' 221122 end-perform
221122 compute rtcub3 = rtcub2 - rtcub1 221122 compute rtcub4 = 7 - rtcub3 221122 move sql-RESULT-record (rtcub1:rtcub3) 221122 to nof-columns (rtcub4:rtcub3) 221122 end-if.
221122 DISPLAY ' '. 221122 display 'END FIND-NOF-COLUMNS'. 221122 DISPLAY '===================='. 221122 DISPLAY ' '.
221122 fncx. exit.
221122 extract-column-info. *** HEREHEREHERE PERFORMED BY DESCRIBEIT
221122 DISPLAY ' '. 221122 display 'EXTRACT-COLUMN-INFO'. 221122 DISPLAY '==================='. 221122 DISPLAY ' '.
221122 move 'N' to column-info-found.
221122 perform varying kount from 1 by 1 until kount > 999
221122 or column-info-found = 'Y'
221122 PERFORM read-SQL-RESULT-file thru RSRFX
221122 if EOF-sql-RESULT = 'N'
221122 move sql-RESULT-record(2:9)
221122 to ninechar
221122 if ninechar = 'SQL type '
221122 PERFORM read-SQL-RESULT-file thru RSRFX
221122 move 'Y' to column-info-found
move 0 to colub1
HEREHEREHERE
221122 MOVE 0 TO INFUB1
HEREHEREHERE
221122 perform varying kount2
221122 from 1 by 1
221122 until kount2 > nof-columns
221122 ADD 1 TO INFUB1
221122** HEREHEREHERE CHECKING OUT THE-SQL ARRAY
221122 PERFORM read-SQL-RESULT-file thru RSRFX
221122 move sql-RESULT-record(02:03)
221122 to the-sql-type(INFUB1)
221122 move sql-RESULT-record(08:14)
221122 to the-sql-type-literal(INFUB1)
221122 move sql-RESULT-record(29:06)
221122 to the-sql-type-length(INFUB1)
221122 move sql-RESULT-record(37:31)
221122 to the-sql-column-name(INFUB1)
221122 DISPLAY 'EXTRACT ++ 221122' 221122 'ADDING 1 TO INFUB1' INFUB1 221122 DISPLAY 'EXTRACT -- 221122' 221122 'the-sql-type(INFUB1) ' 221122 the-sql-type(INFUB1) 221122 DISPLAY 'EXTRACT -- 221122' 221122 'the-sql-type-literal(INFUB1)' 221122 the-sql-type-literal(INFUB1) 221122 DISPLAY 'EXTRACT -- 221122' 221122 'the-sql-type-length(INFUB1) ' 221122 the-sql-type-length(INFUB1) 221122 DISPLAY 'EXTRACT -- 221122' 221122 'the-sql-column-name(INFUB1) ' 221122 the-sql-column-name(INFUB1) 221122 add 1 to colub1 move the-sql-info to the-columns(colub1) 221122 end-perform 221122 end-if 221122 end-if 221122 end-perform.
221122 DISPLAY ' '. 221122 display 'END EXTRACT-COLUMN-INFO'. 221122 DISPLAY '======================='. 221122 DISPLAY ' '.
221122 ecix. exit.
221122 GET-SQLCODE.
221122 DISPLAY ' '. 221122 display 'GET-SQLCODE'. 221122 DISPLAY '==========='. 221122 DISPLAY ' '.
221122 MOVE 'N' TO EOF-SQL-RESULT.
221122 PERFORM VARYING KOUNT FROM 1 BY 1 221122 UNTIL EOF-SQL-RESULT = 'Y'
221122 move 'N' to match-found
221122 perform read-SQL-RESULT-file thru RSRFX
221122 if EOF-sql-RESULT = 'N'
221122 move sql-RESULT-record (1:17)
221122 to seventeenchar
221122 if seventeenchar = ' sqlcaid : SQLCA '
221122 move 'Y' to match-found
221122 end-if
221122 end-if
221122 IF MATCH-FOUND = 'Y'
221122 move 'N' to match-found
221122 perform varying rtcub1 from 1 by 1 221122 until rtcub1 > 60 221122 or match-found = 'Y' 221122 move sql-RESULT-record (rtcub1:9) 221122 to ninechar 221122 if ninechar = 'sqlcode: ' 221122 move 'Y' to match-found 221122 compute rtcub2 = rtcub1 + 9 221122 end-if 221122 end-perform 221122 END-IF
221122 IF MATCH-FOUND = 'Y'
221122 move 'N' to match-found
221122 perform varying rtcub3 from RTCUB2 by 1
221122 until rtcub3 > 60
221122 or match-found = 'Y'
221122 move sql-RESULT-record (rtcub3:9)
221122 to ninechar
221122 if ninechar = ' sqlerr'
221122 move 'Y' to match-found
221122 compute rtcub3 = rtcub3 - rtcub2
221122 move sql-result-record(rtcub2:rtcub3)
221122 to sqllump
221122 if sqllump1 = '-'
221122 move '-' to syne
221122 compute rtcub3 = rtcub3 - 1
221122 move zeroes to nine04-zeroes
221122 compute rtcub4 = 5 - rtcub3
221122 move sqllump(2:rtcub3)
221122 to nine04-zeroes
221122 (rtcub4:rtcub3)
221122 else
221122 move '+' to syne
221122 move zeroes to nine04-zeroes
221122 compute rtcub4 = 5 - rtcub3
221122 move sqllump(1:rtcub3)
221122 to nine04-zeroes
221122 (rtcub4:rtcub3)
221122 end-if
221122 if syne = '+'
221122 compute SQLCODE = nine04-zeroes
221122 else
221122 compute SQLCODE = 0 -
221122 nine04-zeroes
221122 end-if
221122
221122 display 'sqlcode=' SQLCODE
221122 end-if
221122 end-perform
221122 END-IF
221122 end-PERFORM.
221122 DISPLAY ' '. 221122 display 'END GET-SQLCODE'. 221122 DISPLAY '==============='. 221122 DISPLAY ' '.
221122 GSCX. EXIT.
INITIALIZATION-ROUTINE.
DISPLAY '182 '. display '183 INITIALIZATION-ROUTINE'. DISPLAY '184 ======================'. DISPLAY '185 '.
CALL 'START1'.
CALL 'START3'.
OPEN INPUT DATABASE-FILE.
MOVE 'N' TO EOF-DATABASE.
PERFORM READ-DATABASE-FILE THRU RDFX.
IF EOF-DATABASE = 'Y'
DISPLAY 'DB2PREPZ - DATABASE FILE EMPTY'
MOVE 16 TO RETURN-CODE
GO THEVERYEND
END-IF.
IF DATABASE-RECORD = SPACES
DISPLAY 'DB2PREPZ - DATABASE FILE NAME EMPTY'
MOVE 16 TO RETURN-CODE
GO THEVERYEND
END-IF.
OPEN INPUT TARGET-FILE.
MOVE 'N' TO EOF-TARGET.
PERFORM READ-TARGET-FILE THRU RTFX.
IF EOF-TARGET = 'Y'
DISPLAY 'DB2PREPZ - TARGET FILE EMPTY'
MOVE 16 TO RETURN-CODE
GO THEVERYEND
END-IF.
OPEN INPUT INITIALS-FILE.
MOVE 'N' TO EOF-INITIALS.
PERFORM READ-INITIALS-FILE THRU RIIFX.
IF EOF-INITIALS = 'Y'
DISPLAY 'DB2PREPZ - INITIALS FILE EMPTY'
MOVE 16 TO RETURN-CODE
GO THEVERYEND
END-IF.
OPEN INPUT PID-FILE.
MOVE 'N' TO EOF-PID.
PERFORM READ-PID-FILE THRU RPFX.
IF EOF-PID = 'Y'
DISPLAY 'DB2PREPZ - PID FILE EMPTY'
MOVE 16 TO RETURN-CODE
GO THEVERYEND
END-IF.
MOVE INITIALS-RECORD(1:2) TO CPN-INITIALS.
MOVE PID-RECORD(1:4) TO CPN-PROG-ID.
OPEN INPUT IN-FILE.
MOVE 'N' TO EOF-IN.
OPEN OUTPUT OUT-FILE.
OPEN OUTPUT SQL-FILE.
*** OPEN INPUT ERR-FILE. 221122 OPEN OUTPUT ANOTHER-INTO-FILE.
MOVE 0 TO DESCRIBE-NOF-COLUMNS. PERFORM PROCESS-ERR-FILE THRU PEFX.
PERFORM READ-IN-FILE THRU RIFX.
IF EOF-IN = 'Y'
DISPLAY '186 INFILE IS EMPTY'
MOVE 16 TO RETURN-CODE
GO THEVERYEND
END-IF.
MOVE 0 TO IUB1.
MOVE 0 TO WNFUB1. MOVE 0 TO WSEUB1. *** MOVE 0 TO WSWUB1.
DISPLAY '187 '. display '188 END INITIALIZATION-ROUTINE'. DISPLAY '189 =========================='. DISPLAY '190 '.
IRX. EXIT.
221122 MATCH-ANO-LEFT-WITH-SQL-INFO. 221122** MOVE 'N' TO MAL-MATCH. 221122 221122** IF LEFT-OR-RIGHT = 'L' 221122 ADD 1 TO LEFT-COUNT 221122 DISPLAY 'MAL +++ ADDING 1 TO LEFT-COUNT' 221122 LEFT-COUNT 221122** ELSE 221122** GO MALWSIX 221122** END-IF 221122 221122** PERFORM VARYING INFUB2 221122** FROM 1 BY 1 221122** UNTIL INFUB2 > INFUB1 221122** OR MAL-MATCH = 'Y' 221122** HEREHEREHERE OUCH 221122* 221122** WE MARRY ZCOBOL HOST VARIABLE "INTO" VALUES 221122** WITH DB2 "DESCRIBE" VALUES POSITIONALLY, 221122** REMEMBERING THAT THE ANO-RECORD IS WRITTEN 221122** DIRECTLY, NOT FROM ANOTHER-INTO 221122 DISPLAY 'MAL ++' 221122 'LEFT-COUNT' 221122 LEFT-COUNT 221122 DISPLAY 'MAL ++' 221122 'THE-SQL-COLUMN-NAME(LEFT-COUNT)' 221122 THE-SQL-COLUMN-NAME(LEFT-COUNT) 221122** HEREHEREHERE LEFT-COUNT
221122** INFUB2 THE-SQL-COLUMN-NAME(INFUB2)
221122** IF ANOTHER-INTO-LEFT 221122** = THE-SQL-COLUMN-NAME(INFUB2) 221122** MOVE 'Y' TO MAL-MATCH 221122** MOVE THE-SQL-TYPE-LITERAL(INFUB2) 221122* 221122 MOVE ANOTHER-INTO-LEFT TO ANO-LEFT 221122 MOVE ANOTHER-INTO-RIGHT TO ANO-RIGHT 221122 MOVE ANOTHER-SEQ-ID TO ANO-SEQ-ID
221122 MOVE THE-SQL-TYPE-LITERAL(LEFT-COUNT) 221122** HEREHEREHERE USE LEFT-COUNT 221122 TO ANO-TYPE-LITERAL
221122** MOVE THE-SQL-TYPE-LENGTH(INFUB2)
221122 MOVE THE-SQL-TYPE-LENGTH(LEFT-COUNT) 221122** HEREHEREHERE USE LEFT-COUNT 221122 TO ANO-LENGTH
221122** END-IF 221122** END-PERFORM. 221122** IF MAL-MATCH = 'N' 221122** DISPLAY 'DB2PREPZ -' 221122** 'DESCRIBE MISMATCH WITH DESCRIBE INFO' 221122** ANOTHER-INTO-LEFT 221122** MOVE 16 TO RETURN-CODE 221122** GO THEVERYEND 221122** END-IF
221122 DISPLAY 'MAL +' 221122 'ANO-LEFT ' 221122 ANO-LEFT. 221122 DISPLAY 'MAL -' 221122 'ANO-TYPE-LITERAL' 221122 ANO-TYPE-LITERAL. 221122 DISPLAY 'MAL -' 221122 'ANO-LENGTH ' 221122 ANO-LENGTH. 221122 DISPLAY 'MAL -' 221122 'ANO-RIGHT ' 221122 ANO-RIGHT. 221122 DISPLAY 'MAL -' 221122 'ANO-SEQ-ID ' ***221122 ANO-SEQ-ID.
221122 MALWSIX. EXIT
***PROCESS-ERR-FILE.
*** PERFORM READ-ERR-FILE THRU REFX.
IF ERR-FILE-ENDED-FLAG = 'Y' DISPLAY '########################' DISPLAY 'DB2PREPZ - ERR-FILE EMPTY' DISPLAY '########################' PERFORM CLOSE-ERR-FILE THRU CEFX MOVE 16 TO RETURN-CODE GO THEVERYEND END-IF.
MOVE 0 TO WSUB1. PERFORM VARYING KOUNT FROM 1 BY 1 UNTIL ERR-FILE-ENDED-FLAG = 'Y' PERFORM READ-ERR-FILE THRU REFX IF ERR-FILE-ENDED-FLAG = 'N' MOVE ERR-RECORD (33:9) TO NINECHAR IF NINECHAR = 'workstor ' *** MOVE 0 TO STUB1
PERFORM VARYING PRUB1 FROM 41 BY 1 UNTIL PRUB1 > 255 MOVE ERR-RECORD(PRUB1:1) TO ONECHAR MOVE 0 TO PRUB3 IF ONECHAR NOT = SPACE MOVE 'N' TO SPACE-FOUND PERFORM VARYING PRUB2 FROM PRUB1 BY 1 UNTIL SPACE-FOUND = 'Y' MOVE ERR-RECORD(PRUB2:1) TO ONECHAR IF ONECHAR = SPACE MOVE 'Y' TO SPACE-FOUND ELSE ADD 1 TO PRUB3 END-IF END-PERFORM END-IF IF PRUB3 > 0 ADD 1 TO STUB1 MOVE ERR-RECORD(PRUB1:PRUB3) TO STORE(STUB1) ADD PRUB3 TO PRUB1 SUBTRACT 1 FROM PRUB1 END-IF END-PERFORM ADD 1 TO WSUB1 IF WSUB1 > 100 DISPLAY '###################' DISPLAY 'DB2PREPZ - WS- > 100' DISPLAY '###################' PERFORM CLOSE-ERR-FILE THRU CEFX MOVE 16 TO RETURN-CODE GO THEVERYEND END-IF MOVE STORE(1) TO WS-DATA(WSUB1) MOVE STORE(2) TO WS-LVL(WSUB1) MOVE STORE(3) TO WS-ADDR(WSUB1) *** MOVE 'N' TO DIGIT-FOUND
PERFORM VARYING ADUB1 FROM 8 BY -1 UNTIL ADUB1 = 0 OR DIGIT-FOUND = 'Y' MOVE WS-ADDR(WSUB1)(ADUB1:1) TO ONECHAR IF ONECHAR NOT < '0' IF ONECHAR NOT > '9' MOVE 'Y' TO DIGIT-FOUND END-IF END-IF END-PERFORM IF DIGIT-FOUND = 'N' DISPLAY '###############################' DISPLAY 'DB2PREPZ - ADDR STUFFED=' WS-ADDR(WSUB1) DISPLAY '###############################' PERFORM CLOSE-ERR-FILE THRU CEFX MOVE 16 TO RETURN-CODE GO THEVERYEND ELSE ADD 1 TO ADUB1 IF ADUB1 < 8 COMPUTE ADUB2 = 9 - ADUB1 COMPUTE ADUB3 = 9 - ADUB2 MOVE WS-ADDR(WSUB1) TO SAVE-ADDR MOVE '00000000' TO WS-ADDR(WSUB1) MOVE SAVE-ADDR(1:ADUB3) TO WS-ADDR(WSUB1)(ADUB2:ADUB3) END-IF MOVE STORE(1)(1:10) TO TENCHAR IF TENCHAR = 'EYECATCHER' MOVE WS-ADDR(WSUB1) TO ADDRESS-OF-EYECATCHER END-IF END-IF
MOVE STORE(4) TO WS-LEN(WSUB1) MOVE 'N' TO DIGIT-FOUND
PERFORM VARYING ADUB1 FROM 8 BY -1
UNTIL ADUB1 = 0
OR DIGIT-FOUND = 'Y'
MOVE WS-LEN(WSUB1)(ADUB1:1)
TO ONECHAR
IF ONECHAR NOT < '0'
IF ONECHAR NOT > '9'
MOVE 'Y' TO DIGIT-FOUND
END-IF
END-IF
END-PERFORM
IF DIGIT-FOUND = 'N'
DISPLAY '###############################'
DISPLAY 'DB2PREPZ - LEN STUFFED='
WS-LEN(WSUB1)
DISPLAY '###############################'
PERFORM CLOSE-ERR-FILE THRU CEFX
MOVE 16 TO RETURN-CODE
GO THEVERYEND
ELSE
ADD 1 TO ADUB1
IF ADUB1 < 8
COMPUTE ADUB2 = 9 - ADUB1
COMPUTE ADUB3 = 9 - ADUB2
MOVE WS-LEN(WSUB1)
TO SAVE-LEN
MOVE '00000000'
TO WS-LEN(WSUB1)
MOVE SAVE-LEN(1:ADUB3)
TO WS-LEN(WSUB1)(ADUB2:ADUB3)
END-IF
END-IF
MOVE STORE(5) TO WS-PIC(WSUB1)
MOVE STORE(6) TO WS-PIC-TYP(WSUB1)
MOVE STORE(7) TO WS-PIC-SIGN(WSUB1)
MOVE STORE(8) TO WS-PIC-DEC(WSUB1)
END-IF
END-IF
*** END-PERFORM.
*** PERFORM CLOSE-ERR-FILE THRU CEFX.
***PEFX. EXIT.
***CLOSE-ERR-FILE.
*** CLOSE ERR-FILE.
***CEFX. EXIT.
***READ-ERR-FILE.
READ ERR-FILE AT END MOVE 'Y' TO ERR-FILE-ENDED-FLAG GO REFX *** END-READ.
***REFX. EXIT.
READ-IN-FILE.
READ IN-FILE
AT END
MOVE 'Y' TO EOF-IN
GO RIFX
END-READ.
RIFX. EXIT.
***make-s904.
move sql-RESULT-record (rtcub2:4) to fourchar.
IF FOURCHAR(1:1) = '-' MOVE '-' TO SYNE MOVE SPACE TO FOURCHAR(1:1) END-IF.
***ms904x. exit.
READ-DATABASE-FILE.
READ DATABASE-FILE
AT END
MOVE 'Y' TO EOF-DATABASE
GO RDFX
END-READ.
RDFX. EXIT.
READ-TARGET-FILE.
READ TARGET-FILE
AT END
MOVE 'Y' TO EOF-TARGET
GO RTFX
END-READ.
RTFX. EXIT.
READ-INITIALS-FILE.
READ INITIALS-FILE
AT END
MOVE 'Y' TO EOF-INITIALS
GO RIIFX
END-READ.
RIIFX. EXIT.
READ-PID-FILE.
READ PID-FILE
AT END
MOVE 'Y' TO EOF-PID
GO RPFX
END-READ.
RPFX. EXIT.
221122 READ-SQL-RESULT-FILE.
221122 READ SQL-RESULT-FILE 221122 AT END 221122 MOVE 'Y' TO EOF-SQL-RESULT 221122 GO RSRFX 221122 END-READ.
221122 RSRFX. EXIT.
EOJ-ROUTINE.
DISPLAY '191 '. display '192 EOJ-ROUTINE'. DISPLAY '193 ==========='. DISPLAY '194 '.
CALL 'STOP1'.
CALL 'STOP3'.
CLOSE DATABASE-FILE.
CLOSE TARGET-FILE.
CLOSE INITIALS-FILE.
CLOSE PID-FILE.
CLOSE IN-FILE.
CLOSE OUT-FILE.
CLOSE SQL-FILE.
221122 CLOSE ANOTHER-INTO-FILE.
DISPLAY '196 '. display '197 END EOJ-ROUTINE'. DISPLAY '198 ==============='. DISPLAY '199 '.
EX. EXIT.
IDENTIFICATION DIVISION.
PROGRAM-ID. DB2CRE8.
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT INITS-FILE
ASSIGN TO CRE8INTS
ORGANIZATION IS LINE SEQUENTIAL.
SELECT PID-FILE
ASSIGN TO CRE8PID
ORGANIZATION IS LINE SEQUENTIAL.
SELECT SEQ-FILE
ASSIGN TO CRE8SEQ
ORGANIZATION IS LINE SEQUENTIAL.
SELECT IN-FILE
ASSIGN TO CRE8IN
ORGANIZATION IS LINE SEQUENTIAL.
SELECT IN-FILE2
ASSIGN TO CRE8IN2
ORGANIZATION IS LINE SEQUENTIAL.
SELECT OUT-FILE
ASSIGN TO CRE8OUT
ORGANIZATION IS LINE SEQUENTIAL.
SELECT ANOTHER-INTO-FILE
ASSIGN TO CRE8ANO
ORGANIZATION IS LINE SEQUENTIAL.
DATA DIVISION.
FILE SECTION.
FD INITS-FILE
DATA RECORD IS INITS-RECORD.
01 INITS-RECORD.
03 INITS-1-TO-2 PIC X(02).
03 FILLER PIC X(78).
FD PID-FILE
DATA RECORD IS PID-RECORD.
01 PID-RECORD.
03 PID-1-TO-4 PIC X(04).
03 FILLER PIC X(76).
FD SEQ-FILE
DATA RECORD IS SEQ-RECORD.
01 SEQ-RECORD.
03 SEQ-1-TO-2 PIC X(02).
03 FILLER PIC X(78).
FD IN-FILE
DATA RECORD IS IN-RECORD.
01 IN-RECORD.
03 IN-1-TO-7.
05 IN-1-TO-2 PIC X(02).
05 IN-3-TO-4 PIC X(02).
05 IN-5-TO-7 PIC X(03).
03 FILLER PIC X(73).
FD IN-FILE2
DATA RECORD IS IN-RECORD2.
01 IN-RECORD2.
03 FILLER PIC X(07).
03 IN-RECORD2-8-TO-30.
05 IN-RECORD2-8-TO-25 PIC X(18).
05 FILLER PIC X(05).
03 FILLER PIC X(50).
FD OUT-FILE
DATA RECORD IS OUT-RECORD.
01 OUT-RECORD.
03 OUT-1-TO-7 PIC X(07).
03 OUT-8-TO-72 PIC X(65).
03 OUT-73-TO-80 PIC X(08).
FD ANOTHER-INTO-FILE
DATA RECORD IS ANO-RECORD.
01 ANO-RECORD.
03 ANO-LEFT PIC X(31).
03 ANO-TYPE-LITERAL PIC X(14).
03 ANO-LENGTH PIC X(06).
03 ANO-RIGHT PIC X(31).
03 ANO-SEQ-ID.
05 FILLER PIC X(04).
05 ANO-SEQ PIC X(02).
WORKING-STORAGE SECTION.
01 THE-NAME PIC X(31).
01 THE-PICTURE PIC X(80).
01 FOWND PIC X(01).
01 OUB1 PIC S9(02).
01 OUB9 PIC S9(02).
01 OUB10 PIC S9(02).
01 VALUE-FOUND PIC X(01).
01 SEVENCHAR PIC X(07).
01 INITS-EOF PIC X(01).
01 PID-EOF PIC X(01).
01 SEQ-EOF PIC X(01).
01 ANO-EOF PIC X(01).
01 IN-EOF PIC X(01).
01 IN-EOF2 PIC X(01).
01 ANO-FIRST PIC X(01) VALUE 'Y'.
01 LEFT-PICTURES-FOUND PIC X(99).
01 RIGHT-PICTURES-FOUND PIC X(99).
01 ANA-ARRAYSS.
03 ANA-ARRAYS OCCURS 99.
05 ANA-ARRAY.
07 ANA-LEFT PIC X(31).
07 ANA-TYPE-LITERAL PIC X(14).
07 ANA-LENGTH PIC X(06).
07 ANA-RIGHT PIC X(31).
07 ANA-SEQ-ID.
09 FILLER PIC X(04).
09 ANA-SEQ PIC X(02).
07 ANA-LEFT-PICTURE PIC X(80).
07 ANA-RIGHT-PICTURE PIC X(80).
07 ANA-PTR-TO-DP PIC 9(02).
07 ANA-PTR-TO-DC PIC 9(02).
01 ANAB1 PIC 9(02) VALUE 0.
01 ANAB2 PIC 9(02).
01 ANAB3 PIC 9(02).
01 ONECHAR PIC X(01).
01 ONECHAR2 PIC X(01).
01 BACK-FOUND PIC X(01).
01 ANAC1 PIC S9(02).
01 ANAC2 PIC S9(02).
01 IN2UB1 PIC S9(02).
01 IN2UB2 PIC S9(02).
01 IN2UB3 PIC S9(02).
01 IN2UB4 PIC S9(02).
01 COPY-IN-RECORD2 PIC X(80).
01 LEFT-PICTURE-FOUND PIC X(01).
01 RIGHT-PICTURE-FOUND PIC X(01).
01 SAVE-PRECISION PIC 9(02).
01 SAVE-PRECISIONX REDEFINES SAVE-PRECISION PIC X(02).
01 SAVE-SCALE PIC 9(02).
01 SAVE-SCALEX REDEFINES SAVE-SCALE PIC X(02).
01 DCUB1 PIC 9(02).
01 DCUB2 PIC 9(02).
01 DPUB1 PIC 9(02).
01 DPUB2 PIC 9(02).
01 DC-WUB1 PIC 9(02).
01 DC-WUB2 PIC 9(02).
01 DC-TUB1 PIC 9(02).
01 DC-TUB2 PIC 9(02).
01 PP-SS PIC 9(02).
01 PP-SS-PLUS-1 PIC 9(02).
01 THIRTY2-PP-SS PIC 9(02).
01 DECIMAL-POINTERSS.
03 DECIMAL-POINTERS OCCURS 20.
05 DP-PRECISION PIC 9(02).
05 DP-SCALE PIC 9(02).
05 DP-ANAB2 PIC 9(02).
05 DP-DUP PIC X(01).
05 DP-DUP-AT PIC 9(02).
01 DECIMAL-CONSTRUCTS.
03 DECIMAL-CONSTRUCT OCCURS 20.
05 DC-LUMPS.
07 DC-WINE PIC X(80) OCCURS 3.
07 DC-TINE PIC X(80) OCCURS 20.
LINKAGE SECTION.
PROCEDURE DIVISION.
MAINLINE.
*** DISPLAY 'MAINLINE - 1 - ENTRY'
OPEN OUTPUT OUT-FILE
OPEN INPUT INITS-FILE.
MOVE 'N' TO INITS-EOF.
READ INITS-FILE.
IF INITS-EOF = 'Y'
DISPLAY 'DB2CRE8 - "INITS" FILE EMPTY'
PERFORM BOMB
END-IF.
OPEN INPUT PID-FILE.
MOVE 'N' TO PID-EOF.
PERFORM READ-PID-FILE.
IF PID-EOF = 'Y'
DISPLAY 'DB2CRE8 - PID FILE EMPTY'
PERFORM BOMB
END-IF.
OPEN INPUT SEQ-FILE.
MOVE 'N' TO SEQ-EOF.
PERFORM READ-SEQ-FILE.
IF SEQ-EOF = 'Y'
DISPLAY 'DB2CRE8 - SEQ FILE EMPTY'
PERFORM BOMB
END-IF.
OPEN INPUT IN-FILE.
MOVE 'N' TO IN-EOF.
PERFORM READ-IN-FILE.
IF IN-EOF = 'Y'
DISPLAY 'DB2CRE8 - "IN" FILE EMPTY'
PERFORM BOMB
END-IF.
OPEN INPUT ANOTHER-INTO-FILE.
MOVE 'N' TO ANO-EOF.
MOVE 'Y' TO ANO-FIRST.
PERFORM READ-ANOTHER-INTO-FILE.
IF ANO-FIRST = 'Y' AND
ANO-EOF = 'Y'
DISPLAY 'DB2CRE8 - ANO FILE EMPTY'
PERFORM BOMB
END-IF.
*** DISPLAY 'MAINLINE - 2'
PERFORM
UNTIL IN-EOF = 'Y'
PERFORM PROCESS-IN
PERFORM READ-IN-FILE
END-PERFORM.
CLOSE INITS-FILE.
CLOSE PID-FILE.
CLOSE SEQ-FILE.
CLOSE IN-FILE.
CLOSE OUT-FILE.
CLOSE ANOTHER-INTO-FILE.
MOVE 0 TO RETURN-CODE.
*** DISPLAY 'MAINLINE - 3 - EXIT'
STOP RUN.
PROCESS-IN SECTION.
*** DISPLAY ' PI - 1 - ENTRY'
IF IN-3-TO-4 = '01'
PERFORM PROCESS-IN-01
ELSE
IF IN-3-TO-4 = '02'
PERFORM PROCESS-IN-02
ELSE
IF IN-3-TO-4 = '03'
PERFORM PROCESS-IN-03
ELSE
IF IN-3-TO-4 = '04'
PERFORM PROCESS-IN-04
ELSE
IF IN-3-TO-4 = '05'
PERFORM PROCESS-IN-05
END-IF
END-IF
END-IF
END-IF
END-IF.
*** DISPLAY ' PI - 2 - EXIT'
PIX. EXIT.
PROCESS-IN-01 SECTION.
*** DISPLAY ' PI01 - 1 - ENTRY'
MOVE SPACES TO OUT-RECORD.
MOVE 'PROGRAM-ID.' TO OUT-RECORD(8:11).
MOVE INITS-1-TO-2 TO OUT-RECORD(20:2).
MOVE PID-1-TO-4 TO OUT-RECORD(22:4).
MOVE SEQ-1-TO-2 TO OUT-RECORD(26:2).
MOVE '.' TO OUT-RECORD(28:1).
PERFORM WRITE-OUT-RECORD.
MOVE SPACES TO OUT-RECORD.
MOVE '* DO NOT EDIT THIS PROGRAM IT HAS'
TO OUT-RECORD(7:33).
MOVE ' BEEN GENERATED BY DB2CRE8,'
TO OUT-RECORD(40:27).
PERFORM WRITE-OUT-RECORD.
MOVE SPACES TO OUT-RECORD.
MOVE '* RUN VIA DB2PREPZ.'
TO OUT-RECORD(7:19).
PERFORM WRITE-OUT-RECORD.
MOVE SPACES TO OUT-RECORD.
MOVE '* ANY CHANGES YOU MAKE WILL BE LOST'
TO OUT-RECORD(7:35).
MOVE ' THE NEXT TIME DB2PREPZ IS RUN'
TO OUT-RECORD(42:30).
PERFORM WRITE-OUT-RECORD.
*** DISPLAY ' PI01 - 2 - EXIT'
PI01X. EXIT.
PROCESS-IN-02 SECTION.
*** DISPLAY ' PI02 - 1 - ENTRY'
OPEN INPUT IN-FILE2.
MOVE 'N' TO IN-EOF2.
PERFORM READ-IN-FILE2.
IF IN-EOF2 = 'Y'
DISPLAY 'DB2CRE8 - "IN FILE2" EMPTY'
PERFORM BOMB
END-IF.
PERFORM READ-IN-FILE2
UNTIL IN-EOF2 = 'Y'
OR IN-RECORD2-8-TO-30
=
'WORKING-STORAGE SECTION'
END-PERFORM.
IF IN-EOF2 = 'Y'
DISPLAY 'DB2CRE8 - "IN FILE2"'
'WORKING-STORAGE SECTION'
'NOT FOUND'
PERFORM BOMB
END-IF.
*** DISPLAY ' PI01 - 2'
MOVE ALL 'N' TO LEFT-PICTURES-FOUND.
MOVE ALL 'N' TO RIGHT-PICTURES-FOUND.
PERFORM
UNTIL IN-EOF2 = 'Y'
OR IN-RECORD2-8-TO-25
=
'PROCEDURE DIVISION'
DISPLAY ' PI02 - 2.01 - FTP' PERFORM FIND-THE-PICTURES DISPLAY ' PI02 - 2.02 - RIF2' PERFORM READ-IN-FILE2 END-PERFORM.
IF IN-EOF2 = 'Y'
DISPLAY 'DB2CRE8 - "IN FILE2"'
'PROCEDURE DIVISION'
'NOT FOUND'
PERFORM BOMB
END-IF.
*** DISPLAY ' PI01 - 3'
PERFORM VARYING ANAB2
FROM 1 BY 1
UNTIL ANAB2 > ANAB1
MOVE LEFT-PICTURES-FOUND(ANAB2:1)
TO ONECHAR
IF ONECHAR = 'N'
DISPLAY 'DB2CRE8 - "IN FILE2"'
ANA-LEFT(ANAB2)
'NOT FOUND'
PERFORM BOMB
END-IF
IF ANA-RIGHT(ANAB2) NOT = SPACES
MOVE RIGHT-PICTURES-FOUND(ANAB2:1)
TO ONECHAR
IF ONECHAR = 'N'
DISPLAY 'DB2CRE8 - "IN FILE2"'
ANA-RIGHT(ANAB2)
'NOT FOUND'
PERFORM BOMB
END-IF
END-IF
*** DISPLAY ' PI01 - 4'
END-PERFORM.
CLOSE IN-FILE2.
*** DISPLAY ' PI01 - 5'
PERFORM VARYING ANAB2
FROM 1 BY 1
UNTIL ANAB2 > ANAB1
MOVE ANA-LEFT(ANAB2)
TO THE-NAME
MOVE SPACES TO THE-PICTURE
MOVE 'N' TO FOWND
CALL 'FORTY9' USING THE-NAME, THE-PICTURE, FOWND
IF FOWND = 'Y'
MOVE THE-PICTURE TO OUT-RECORD
PERFORM WRITE-OUT-RECORD
ELSE
IF FOWND = 'X'
DISPLAY 'SUB-PROGRAM FORTY9'
'BOMBED RE THE ERRFILE'
PERFORM BOMB
ELSE
MOVE ANA-LEFT-PICTURE(ANAB2)
TO OUT-RECORD
PERFORM UNTAIL-PICTURE
PERFORM WRITE-OUT-RECORD
END-IF
END-IF
*** DISPLAY ' PI01 - 6'
IF ANA-RIGHT(ANAB2) NOT = SPACES
MOVE ANA-RIGHT-PICTURE(ANAB2)
TO OUT-RECORD
PERFORM UNTAIL-PICTURE
PERFORM WRITE-OUT-RECORD
END-IF
END-PERFORM.
*** DISPLAY ' PI01 - 7 - EXIT'
PI02X. EXIT.
UNTAIL-PICTURE SECTION.
*** DISPLAY ' UP - 1 - ENTRY'
MOVE 'N' TO BACK-FOUND.
PERFORM VARYING OUB1
FROM 72 BY -1
UNTIL BACK-FOUND = 'Y'
OR OUB1 = 8
MOVE OUT-RECORD(OUB1:1)
TO ONECHAR
IF ONECHAR NOT = ' '
MOVE 'Y' TO BACK-FOUND
MOVE OUB1 TO OUB9
END-IF
END-PERFORM.
IF BACK-FOUND = 'N'
DISPLAY 'DB2CRE8 - CORRUPT LINE1'
OUT-RECORD
PERFORM BOMB
END-IF.
MOVE 'N' TO VALUE-FOUND.
PERFORM VARYING OUB1
FROM OUB9 BY -1
UNTIL VALUE-FOUND = 'Y'
OR OUB1 = 8
MOVE OUT-RECORD(OUB1:7)
TO SEVENCHAR
IF SEVENCHAR = ' VALUE '
OR SEVENCHAR = ' value '
MOVE 'Y' TO VALUE-FOUND
MOVE OUB1 TO OUB9
END-IF
END-PERFORM
MOVE '.' TO OUT-RECORD(OUB9:1).
COMPUTE OUB10 = OUB9 + 1.
PERFORM VARYING OUB1
FROM OUB10 BY 1
UNTIL OUB1 > 72
MOVE ' '
TO OUT-RECORD(OUB1:1)
END-PERFORM.
*** DISPLAY ' UP - 2 - EXIT'
UPX. EXIT.
PROCESS-IN-03 SECTION.
*** DISPLAY ' PI03 - 1 - ENTRY'
MOVE SPACES TO OUT-RECORD.
MOVE 'PROCEDURE DIVISION USING'
TO OUT-RECORD(8:24).
PERFORM WRITE-OUT-RECORD.
PERFORM VARYING ANAB2
FROM 1 BY 1
UNTIL ANAB2 > ANAB1
IF ANA-RIGHT-PICTURE(ANAB2) = SPACES
MOVE SPACES TO OUT-RECORD
IF ANAB2 NOT = ANAB1
MOVE ANA-LEFT(ANAB2)
TO OUT-RECORD(30:31)
MOVE ','
TO OUT-RECORD(61:1)
PERFORM WRITE-OUT-RECORD
ELSE
MOVE ANA-LEFT(ANAB2)
TO OUT-RECORD(30:31)
MOVE '.'
TO OUT-RECORD(61:1)
PERFORM WRITE-OUT-RECORD
END-IF
ELSE
MOVE SPACES TO OUT-RECORD
MOVE ANA-LEFT(ANAB2)
TO OUT-RECORD(30:31)
MOVE ','
TO OUT-RECORD(61:1)
PERFORM WRITE-OUT-RECORD
IF ANAB2 NOT = ANAB1
MOVE ANA-RIGHT(ANAB2)
TO OUT-RECORD(30:31)
MOVE ','
TO OUT-RECORD(61:1)
PERFORM WRITE-OUT-RECORD
ELSE
MOVE ANA-RIGHT(ANAB2)
TO OUT-RECORD(30:31)
MOVE '.'
TO OUT-RECORD(61:1)
PERFORM WRITE-OUT-RECORD
END-IF
END-IF
END-PERFORM.
*** DISPLAY ' PI03 - 2 - EXIT'
PI03X. EXIT.
PROCESS-IN-04 SECTION.
*** DISPLAY ' PI4 - 1 - ENTRY'
PERFORM VARYING ANAB2
FROM 1 BY 1
UNTIL ANAB2 > ANAB1
IF ANA-TYPE-LITERAL(ANAB2) = 'DECIMAL'
*** DISPLAY ' PI4 - 2 - DECIMAL'
MOVE ANA-PTR-TO-DC(ANAB2) TO DCUB2
DISPLAY ' PI4 - 2.1 - ANAB2=' ANAB2 'DCUB2=' DCUB2 DISPLAY ' PI4 - 2.2 - ANA-PTR-TO-DC(ANAB2)' ANA-PTR-TO-DC(ANAB2) PERFORM VARYING DC-TUB2 FROM 1 BY 1 UNTIL DC-TUB2 > 20 IF DC-TINE(DCUB2,DC-TUB2) NOT = SPACES DISPLAY ' PI4 - 2.3 - DC-TUB2=' DC-TUB2 MOVE DC-TINE(DCUB2,DC-TUB2) TO OUT-RECORD PERFORM WRITE-OUT-RECORD END-IF END-PERFORM ELSE
*** DISPLAY ' PI4 - 3 - NOT DECIMAL '
MOVE SPACES TO OUT-RECORD
MOVE 'IF ANO-COUNT = ' TO OUT-RECORD(12:15)
MOVE ANAB2 TO OUT-RECORD(27:2)
PERFORM WRITE-OUT-RECORD
IF ANA-RIGHT(ANAB2) NOT = SPACES
DISPLAY ' PI4 - 4 - ' ANAB2 *** 'R NOT SPACES'
MOVE SPACES TO OUT-RECORD
MOVE 'IF INULL = ''Y''' TO OUT-RECORD(16:14)
PERFORM WRITE-OUT-RECORD
MOVE SPACES TO OUT-RECORD
MOVE 'MOVE -1 TO ' TO OUT-RECORD(20:11)
MOVE ANA-RIGHT(ANAB2) TO OUT-RECORD(31:31)
PERFORM WRITE-OUT-RECORD
MOVE SPACES TO OUT-RECORD
MOVE 'ELSE' TO OUT-RECORD(16:4)
PERFORM WRITE-OUT-RECORD
MOVE SPACES TO OUT-RECORD
MOVE 'MOVE ZERO TO ' TO OUT-RECORD(20:13)
MOVE ANA-RIGHT(ANAB2) TO OUT-RECORD(33:31)
PERFORM WRITE-OUT-RECORD
IF ANA-TYPE-LITERAL(ANAB2)
= 'DATE'
*** DISPLAY ' PI4 - 5 - ' ANAB2 'DATE' MOVE SPACES TO OUT-RECORD MOVE 'MOVE ACTULE(1:10)' TO OUT-RECORD(20:17) PERFORM WRITE-OUT-RECORD
MOVE SPACES TO OUT-RECORD
MOVE 'TO '
TO OUT-RECORD(20:3)
MOVE ANA-LEFT(ANAB2) TO OUT-RECORD(23:31)
PERFORM WRITE-OUT-RECORD
ELSE
IF ANA-TYPE-LITERAL(ANAB2)
= 'TIME'
*** DISPLAY ' PI4 - 6 - ' ANAB2 'TIME' MOVE SPACES TO OUT-RECORD MOVE 'MOVE ACTULE(1:8)' TO OUT-RECORD(20:16) PERFORM WRITE-OUT-RECORD
MOVE SPACES TO OUT-RECORD
MOVE 'TO '
TO OUT-RECORD(20:3)
MOVE ANA-LEFT(ANAB2) TO OUT-RECORD(23:31)
PERFORM WRITE-OUT-RECORD
ELSE
IF ANA-TYPE-LITERAL(ANAB2)
= 'TIMESTAMP'
*** DISPLAY ' PI4 - 7 - ' ANAB2 'TIMESTAMP' MOVE SPACES TO OUT-RECORD MOVE 'MOVE ACTULE(1:26)' TO OUT-RECORD(20:17) PERFORM WRITE-OUT-RECORD
MOVE SPACES TO OUT-RECORD
MOVE 'TO '
TO OUT-RECORD(20:3)
MOVE ANA-LEFT(ANAB2) TO OUT-RECORD(23:31)
PERFORM WRITE-OUT-RECORD
ELSE
IF ANA-TYPE-LITERAL(ANAB2)
= 'CHARACTER'
*** DISPLAY ' PI4 - 8 - ' ANAB2 'CHARACTER' MOVE SPACES TO OUT-RECORD MOVE 'MOVE TA-WLEN(TAB2) TO A-WLEN' TO OUT-RECORD(20:28) PERFORM WRITE-OUT-RECORD
MOVE SPACES TO OUT-RECORD
MOVE 'MOVE ACTULE(1:A-WLEN)'
TO OUT-RECORD(20:21)
PERFORM WRITE-OUT-RECORD
MOVE SPACES TO OUT-RECORD
MOVE 'TO '
TO OUT-RECORD(20:3)
MOVE ANA-LEFT(ANAB2) TO OUT-RECORD(23:31)
PERFORM WRITE-OUT-RECORD
ELSE
IF ANA-TYPE-LITERAL(ANAB2)
= 'VARCHAR'
*** DISPLAY ' PI4 - 9 - ' ANAB2 'VARCHAR' MOVE SPACES TO OUT-RECORD MOVE 'MOVE TA-WLEN(TAB2) TO A-WLEN' TO OUT-RECORD(20:28) PERFORM WRITE-OUT-RECORD
MOVE SPACES TO OUT-RECORD
MOVE 'MOVE A-WLEN TO VARCHAR-LENGTH'
TO OUT-RECORD(20:29)
PERFORM WRITE-OUT-RECORD
MOVE SPACES TO OUT-RECORD
MOVE 'MOVE ACTULE(1:A-WLEN)'
TO OUT-RECORD(20:21)
PERFORM WRITE-OUT-RECORD
MOVE SPACES TO OUT-RECORD
MOVE 'TO VARCHAR-CONTENTS'
TO OUT-RECORD(20:19)
PERFORM WRITE-OUT-RECORD
MOVE SPACES TO OUT-RECORD
MOVE 'MOVE VARCHAR TO '
TO OUT-RECORD(20:16)
PERFORM WRITE-OUT-RECORD
MOVE SPACES TO OUT-RECORD
MOVE ANA-LEFT(ANAB2) TO OUT-RECORD(23:31)
PERFORM WRITE-OUT-RECORD
ELSE
IF ANA-TYPE-LITERAL(ANAB2) = 'DECIMAL'
*** DISPLAY 'PI4 - 08 - ' ANAB2 'DECIMAL'
MOVE SPACES TO OUT-RECORD
MOVE 'COMPUTE'
TO OUT-RECORD(20:7)
MOVE ANA-LEFT(ANAB2) TO OUT-RECORD(28:31)
*** PERFORM WRITE-OUT-RECORD
MOVE SPACES TO OUT-RECORD MOVE '=' TO OUT-RECORD(28:1) PERFORM WRITE-OUT-RECORD
MOVE SPACES TO OUT-RECORD MOVE 'NINE31V' TO OUT-RECORD(28:7) PERFORM WRITE-OUT-RECORD
MOVE SPACES TO OUT-RECORD
MOVE 'COMPUTE'
TO OUT-RECORD(20:7)
MOVE ANA-LEFT(ANAB2) TO OUT-RECORD(28:31)
*** PERFORM WRITE-OUT-RECORD
MOVE SPACES TO OUT-RECORD MOVE '=' TO OUT-RECORD(28:1) PERFORM WRITE-OUT-RECORD
MOVE SPACES TO OUT-RECORD MOVE ANA-LEFT(ANAB2) TO OUT-RECORD(28:31) *** PERFORM WRITE-OUT-RECORD
MOVE SPACES TO OUT-RECORD MOVE '+' TO OUT-RECORD(28:1) PERFORM WRITE-OUT-RECORD
MOVE SPACES TO OUT-RECORD MOVE 'VNINE31' TO OUT-RECORD(28:7) PERFORM WRITE-OUT-RECORD
MOVE SPACES TO OUT-RECORD
MOVE 'COMPUTE'
TO OUT-RECORD(20:7)
MOVE ANA-LEFT(ANAB2) TO OUT-RECORD(28:31)
*** PERFORM WRITE-OUT-RECORD
MOVE SPACES TO OUT-RECORD MOVE '=' TO OUT-RECORD(28:1) PERFORM WRITE-OUT-RECORD
MOVE SPACES TO OUT-RECORD MOVE ANA-LEFT(ANAB2) TO OUT-RECORD(28:31) *** PERFORM WRITE-OUT-RECORD
MOVE SPACES TO OUT-RECORD MOVE '*' TO OUT-RECORD(28:1) PERFORM WRITE-OUT-RECORD
MOVE SPACES TO OUT-RECORD MOVE 'MULTIPLIER' TO OUT-RECORD(28:10) PERFORM WRITE-OUT-RECORD ELSE IF ANA-TYPE-LITERAL(ANAB2) = 'BIGINT' DISPLAY ' PI4 - 10 - ' ANAB2 'BIGINT' MOVE SPACES TO OUT-RECORD MOVE 'MOVE SIGNED-LONG-NUMERIC' TO OUT-RECORD(20:24) PERFORM WRITE-OUT-RECORD
MOVE SPACES TO OUT-RECORD
MOVE 'TO '
TO OUT-RECORD(22:3)
MOVE ANA-LEFT(ANAB2) TO OUT-RECORD(25:31)
PERFORM WRITE-OUT-RECORD
ELSE
IF ANA-TYPE-LITERAL(ANAB2)
= 'INTEGER'
*** DISPLAY ' PI4 - 11 - ' ANAB2 'INTEGER' MOVE SPACES TO OUT-RECORD MOVE 'MOVE SIGNED-LONG-NUMERIC' TO OUT-RECORD(20:24) PERFORM WRITE-OUT-RECORD
MOVE SPACES TO OUT-RECORD
MOVE 'TO '
TO OUT-RECORD(22:3)
MOVE ANA-LEFT(ANAB2) TO OUT-RECORD(25:31)
PERFORM WRITE-OUT-RECORD
ELSE
IF ANA-TYPE-LITERAL(ANAB2)
= 'SMALLINT'
*** DISPLAY ' PI4 - 12 - ' ANAB2 'SMALLINT' MOVE SPACES TO OUT-RECORD MOVE 'MOVE SIGNED-LONG-NUMERIC' TO OUT-RECORD(20:24) PERFORM WRITE-OUT-RECORD
MOVE SPACES TO OUT-RECORD
MOVE 'TO '
TO OUT-RECORD(22:3)
MOVE ANA-LEFT(ANAB2) TO OUT-RECORD(25:31)
PERFORM WRITE-OUT-RECORD
END-IF
END-IF
END-IF
END-IF
END-IF
END-IF
END-IF
END-IF
*** REMOVE ONE END-IF BECAUSE NO DECIMAL
*** DISPLAY ' PI4 - 13 - ' ANAB2 MOVE SPACES TO OUT-RECORD MOVE 'END-IF' TO OUT-RECORD(16:06) PERFORM WRITE-OUT-RECORD
MOVE SPACES TO OUT-RECORD
MOVE 'END-IF' TO OUT-RECORD(12:06)
PERFORM WRITE-OUT-RECORD
ELSE
DISPLAY ' PI4 - 14 - ' ANAB2 *** 'R SPACES'
IF ANA-TYPE-LITERAL(ANAB2)
= 'DATE'
*** DISPLAY ' PI4 - 15 - ' ANAB2 'DATE' MOVE SPACES TO OUT-RECORD MOVE 'MOVE ACTULE(1:10)' TO OUT-RECORD(16:17) PERFORM WRITE-OUT-RECORD
MOVE SPACES TO OUT-RECORD
MOVE 'TO '
TO OUT-RECORD(20:3)
MOVE ANA-LEFT(ANAB2) TO OUT-RECORD(23:31)
PERFORM WRITE-OUT-RECORD
ELSE
IF ANA-TYPE-LITERAL(ANAB2)
= 'TIME'
*** DISPLAY ' PI4 - 16 - ' ANAB2 'TIME' MOVE SPACES TO OUT-RECORD MOVE 'MOVE ACTULE(1:8)' TO OUT-RECORD(16:16) PERFORM WRITE-OUT-RECORD
MOVE SPACES TO OUT-RECORD
MOVE 'TO '
TO OUT-RECORD(20:3)
MOVE ANA-LEFT(ANAB2) TO OUT-RECORD(23:31)
PERFORM WRITE-OUT-RECORD
ELSE
IF ANA-TYPE-LITERAL(ANAB2)
= 'TIMESTAMP'
*** DISPLAY ' PI4 - 17 - ' ANAB2 'TIMESTAMP' MOVE SPACES TO OUT-RECORD MOVE 'MOVE ACTULE(1:26)' TO OUT-RECORD(16:17) PERFORM WRITE-OUT-RECORD
MOVE SPACES TO OUT-RECORD
MOVE 'TO '
TO OUT-RECORD(20:3)
MOVE ANA-LEFT(ANAB2) TO OUT-RECORD(23:31)
PERFORM WRITE-OUT-RECORD
ELSE
IF ANA-TYPE-LITERAL(ANAB2)
= 'CHARACTER'
*** DISPLAY ' PI4 - 18 - ' ANAB2 'CHARACTER' MOVE SPACES TO OUT-RECORD MOVE 'MOVE TA-WLEN(TAB2) TO A-WLEN' TO OUT-RECORD(16:28) PERFORM WRITE-OUT-RECORD
MOVE SPACES TO OUT-RECORD
MOVE 'MOVE ACTULE(1:A-WLEN)'
TO OUT-RECORD(16:21)
PERFORM WRITE-OUT-RECORD
MOVE SPACES TO OUT-RECORD
MOVE 'TO '
TO OUT-RECORD(16:3)
MOVE ANA-LEFT(ANAB2) TO OUT-RECORD(19:31)
PERFORM WRITE-OUT-RECORD
ELSE
IF ANA-TYPE-LITERAL(ANAB2)
= 'VARCHAR'
*** DISPLAY ' PI4 - 19 - ' ANAB2 'VARCHAR' MOVE SPACES TO OUT-RECORD MOVE 'MOVE TA-WLEN(TAB2) TO A-WLEN' TO OUT-RECORD(16:28) PERFORM WRITE-OUT-RECORD
MOVE SPACES TO OUT-RECORD
MOVE 'MOVE A-WLEN TO VARCHAR-LENGTH'
TO OUT-RECORD(16:29)
PERFORM WRITE-OUT-RECORD
MOVE SPACES TO OUT-RECORD
MOVE 'MOVE ACTULE(1:A-WLEN)'
TO OUT-RECORD(16:21)
PERFORM WRITE-OUT-RECORD
MOVE SPACES TO OUT-RECORD
MOVE 'TO VARCHAR-CONTENTS'
TO OUT-RECORD(18:19)
PERFORM WRITE-OUT-RECORD
MOVE SPACES TO OUT-RECORD
MOVE 'MOVE VARCHAR TO' TO OUT-RECORD(16:15)
PERFORM WRITE-OUT-RECORD
MOVE SPACES TO OUT-RECORD
MOVE ANA-LEFT(ANAB2) TO OUT-RECORD(19:31)
PERFORM WRITE-OUT-RECORD
ELSE
IF ANA-TYPE-LITERAL(ANAB2) = 'DECIMAL' *** DISPLAY 'PI4 - 18 - ' ANAB2 'DECIMAL'
MOVE SPACES TO OUT-RECORD
MOVE 'COMPUTE'
TO OUT-RECORD(16:7)
MOVE ANA-LEFT(ANAB2) TO OUT-RECORD(24:31)
*** PERFORM WRITE-OUT-RECORD
MOVE SPACES TO OUT-RECORD MOVE '=' TO OUT-RECORD(24:1) PERFORM WRITE-OUT-RECORD
MOVE SPACES TO OUT-RECORD MOVE 'NINE31V' TO OUT-RECORD(24:7) PERFORM WRITE-OUT-RECORD
MOVE SPACES TO OUT-RECORD
MOVE 'COMPUTE'
TO OUT-RECORD(16:7)
MOVE ANA-LEFT(ANAB2) TO OUT-RECORD(24:31)
*** PERFORM WRITE-OUT-RECORD
MOVE SPACES TO OUT-RECORD MOVE '=' TO OUT-RECORD(24:1) PERFORM WRITE-OUT-RECORD
MOVE SPACES TO OUT-RECORD MOVE ANA-LEFT(ANAB2) TO OUT-RECORD(24:31) *** PERFORM WRITE-OUT-RECORD
MOVE SPACES TO OUT-RECORD MOVE '+' TO OUT-RECORD(24:1) PERFORM WRITE-OUT-RECORD
MOVE SPACES TO OUT-RECORD MOVE 'VNINE31' TO OUT-RECORD(24:7) PERFORM WRITE-OUT-RECORD
MOVE SPACES TO OUT-RECORD
MOVE 'COMPUTE'
TO OUT-RECORD(16:7)
MOVE ANA-LEFT(ANAB2) TO OUT-RECORD(24:31)
*** PERFORM WRITE-OUT-RECORD
MOVE SPACES TO OUT-RECORD MOVE '=' TO OUT-RECORD(24:1) PERFORM WRITE-OUT-RECORD
MOVE SPACES TO OUT-RECORD MOVE ANA-LEFT(ANAB2) TO OUT-RECORD(24:31) *** PERFORM WRITE-OUT-RECORD
MOVE SPACES TO OUT-RECORD MOVE '*' TO OUT-RECORD(24:1) PERFORM WRITE-OUT-RECORD
MOVE SPACES TO OUT-RECORD MOVE 'MULTIPLIER' TO OUT-RECORD(24:10) PERFORM WRITE-OUT-RECORD ELSE IF ANA-TYPE-LITERAL(ANAB2) = 'BIGINT' DISPLAY ' PI4 - 20 - ' ANAB2 'BIGINT' MOVE SPACES TO OUT-RECORD MOVE 'MOVE SIGNED-LONG-NUMERIC' TO OUT-RECORD(16:24) PERFORM WRITE-OUT-RECORD
MOVE SPACES TO OUT-RECORD
MOVE 'TO '
TO OUT-RECORD(18:3)
MOVE ANA-LEFT(ANAB2) TO OUT-RECORD(21:31)
PERFORM WRITE-OUT-RECORD
ELSE
IF ANA-TYPE-LITERAL(ANAB2)
= 'INTEGER'
*** DISPLAY ' PI4 - 21 - ' ANAB2 'INTEGER' MOVE SPACES TO OUT-RECORD MOVE 'MOVE SIGNED-LONG-NUMERIC' TO OUT-RECORD(16:24) PERFORM WRITE-OUT-RECORD
MOVE SPACES TO OUT-RECORD
MOVE 'TO '
TO OUT-RECORD(18:3)
MOVE ANA-LEFT(ANAB2) TO OUT-RECORD(21:31)
PERFORM WRITE-OUT-RECORD
ELSE
IF ANA-TYPE-LITERAL(ANAB2)
= 'SMALLINT'
*** DISPLAY ' PI4 - 22 - ' ANAB2 'SMALLINT' MOVE SPACES TO OUT-RECORD MOVE 'MOVE SIGNED-LONG-NUMERIC' TO OUT-RECORD(16:24) PERFORM WRITE-OUT-RECORD
MOVE SPACES TO OUT-RECORD
MOVE 'TO '
TO OUT-RECORD(18:3)
MOVE ANA-LEFT(ANAB2) TO OUT-RECORD(21:31)
PERFORM WRITE-OUT-RECORD
END-IF
END-IF
END-IF
END-IF
END-IF
END-IF
END-IF
END-IF
*** REMOVE ONE END-IF BECAUSE NO DECIMAL
*** DISPLAY ' PI4 - 23 - ' ANAB2 MOVE SPACES TO OUT-RECORD MOVE 'END-IF' TO OUT-RECORD(12:06) PERFORM WRITE-OUT-RECORD
END-IF
*** DISPLAY ' PI4 - 24'
END-IF
*** DISPLAY ' PI4 - 25'
END-PERFORM.
DISPLAY ' PI4 - 26' MOVE SPACES TO OUT-RECORD. MOVE '.' TO OUT-RECORD(12:1). PERFORM WRITE-OUT-RECORD. DISPLAY ' PI4 - 27 - EXIT'.
PI04X. EXIT.
FIND-THE-PICTURES SECTION.
PERFORM VARYING ANAB3
FROM 1 BY 1
UNTIL ANAB3 > ANAB1
*** DISPLAY 'FTP - 01 - ANA-LEFT(ANAB3)' ANA-LEFT(ANAB3)
MOVE 'N' TO BACK-FOUND
PERFORM VARYING ANAC1
FROM 31 BY -1
UNTIL ANAC1 = 0
OR BACK-FOUND = 'Y'
MOVE ANA-LEFT(ANAB3)(ANAC1:1)
TO ONECHAR
IF ONECHAR NOT = SPACES
MOVE 'Y' TO BACK-FOUND
END-IF
END-PERFORM
IF BACK-FOUND = 'N'
DISPLAY 'DB2CRE8 - ANA-LEFT CORRUPT' PERFORM BOMB ELSE COMPUTE IN2UB2 = 72 - ANAC1 COMPUTE ANAC2 = ANAC1 + 1 DISPLAY 'FTP - 02 - BACK FOUND AT' *** ANAC2
PERFORM VARYING IN2UB1
FROM 8 BY 1
UNTIL IN2UB1 > IN2UB2
MOVE SPACES
TO COPY-IN-RECORD2
COMPUTE IN2UB3 = IN2UB1 - 1
COMPUTE IN2UB4 = IN2UB1 + ANAC2
MOVE IN-RECORD2(IN2UB1:ANAC2)
TO COPY-IN-RECORD2(1:ANAC2)
MOVE IN-RECORD2(IN2UB3:1) TO ONECHAR
MOVE IN-RECORD2(IN2UB4:1) TO ONECHAR2
IF (ANA-LEFT(ANAB3) = COPY-IN-RECORD2) DISPLAY '----------------------------------' DISPLAY 'FTP - 4.01 -' ANAB3 ANA-LEFT(ANAB3) DISPLAY 'FTP - 4.02 ->' ONECHAR '<' DISPLAY 'FTP - 4.03 ->' ONECHAR2 '<' DISPLAY '----------------------------------' *** END-IF IF (ANA-LEFT(ANAB3) = COPY-IN-RECORD2) AND (ONECHAR = SPACE AND (ONECHAR2 = SPACE or onechar2 = '.'))
*** DISPLAY 'FTP - 5 -' ANAB3 ANA-LEFT(ANAB3) MOVE 'Y' TO LEFT-PICTURES-FOUND(ANAB3:1) MOVE IN-RECORD2 TO ANA-LEFT-PICTURE(ANAB3) END-IF
END-PERFORM
END-IF
IF ANA-RIGHT(ANAB3) NOT = SPACES
MOVE 'N' TO BACK-FOUND
PERFORM VARYING ANAC1
FROM 31 BY -1
UNTIL ANAC1 = 0
OR BACK-FOUND = 'Y'
MOVE ANA-RIGHT(ANAB3)(ANAC1:1)
TO ONECHAR
IF ONECHAR NOT = SPACES
MOVE 'Y' TO BACK-FOUND
END-IF
END-PERFORM
IF BACK-FOUND = 'N'
DISPLAY 'DB2CRE8 - ANA-RIGHT CORRUPT'
PERFORM BOMB
ELSE
COMPUTE IN2UB2 = 72 - ANAC1
COMPUTE ANAC2 = ANAC1 + 1
PERFORM VARYING IN2UB1
FROM 8 BY 1
UNTIL IN2UB1 > IN2UB2
MOVE SPACES
TO COPY-IN-RECORD2
COMPUTE IN2UB3 = IN2UB1 - 1
COMPUTE IN2UB4 = IN2UB1 + ANAC2
MOVE IN-RECORD2(IN2UB1:ANAC2)
TO COPY-IN-RECORD2(1:ANAC2)
MOVE IN-RECORD2(IN2UB3:1) TO ONECHAR
MOVE IN-RECORD2(IN2UB4:1) TO ONECHAR2
IF (ANA-RIGHT(ANAB3)
=
COPY-IN-RECORD2)
AND
(ONECHAR = SPACE
AND
ONECHAR2 = SPACE)
DISPLAY 'FTP - 5 RIGHT -' ANAB3 ANA-RIGHT(ANAB3) MOVE 'Y' TO RIGHT-PICTURES-FOUND(ANAB3:1) MOVE IN-RECORD2 TO ANA-RIGHT-PICTURE (ANAB3) END-IF END-PERFORM END-IF END-IF END-PERFORM.
*** DISPLAY 'FTP - COMPLETED ANAB1' ANAB1 'ANAB3' ANAB3
FTPX. EXIT.
PROCESS-IN-05 SECTION.
*** DISPLAY ' PI5 - 1 - ENTRY' MOVE 0 TO DCUB1 MOVE 0 TO DPUB1 MOVE SPACES TO DECIMAL-CONSTRUCTS MOVE SPACES TO DECIMAL-POINTERSS
PERFORM VARYING ANAB2
FROM 1 BY 1
UNTIL ANAB2 > ANAB1
*** DISPLAY ' PI5 - 2'
MOVE ZEROES TO SAVE-PRECISION
MOVE ZEROES TO SAVE-SCALE
DISPLAY ' PI5 - 2.1 - ANA-LENGTH'
ANAB2 '>' ANA-LENGTH(ANAB2) '<'
MOVE ANA-LENGTH(ANAB2)(4:1)
TO ONECHAR
IF ONECHAR = ','
*** THE COMMA IN THAT POSITION MEANS IT IS A DECIMAL FIELD
*** DISPLAY ' PI5 - 3 - DECIMAL'
MOVE ANA-LENGTH(ANAB2)(2:1)
TO ONECHAR
IF ONECHAR NOT = SPACE
MOVE ONECHAR TO SAVE-PRECISIONX(1:1)
END-IF
MOVE ANA-LENGTH(ANAB2)(3:1)
TO SAVE-PRECISIONX(2:1)
MOVE ANA-LENGTH(ANAB2)(5:1)
TO ONECHAR
IF ONECHAR NOT = SPACE
MOVE ONECHAR TO SAVE-SCALEX(1:1)
END-IF
MOVE ANA-LENGTH(ANAB2)(6:1)
TO SAVE-SCALEX(2:1)
MOVE SAVE-PRECISIONX TO ANA-LENGTH(ANAB2)(2:2)
MOVE SAVE-SCALEX TO ANA-LENGTH(ANAB2)(5:2)
*** DISPLAY ' PI5 - 4'
IF DPUB1 = 0
*** DISPLAY ' PI5 - 5 - DPUB1=0'
ADD 1 TO DPUB1
MOVE DPUB1 TO ANA-PTR-TO-DP(ANAB2)
DISPLAY ' PI5 - 5.1 - ANAB2' ANAB2 'ANA-PTR-TO-DP' ANA-PTR-TO-DP(ANAB2) MOVE ANAB2 TO DP-ANAB2 (DPUB1) MOVE SAVE-PRECISION TO DP-PRECISION (DPUB1) MOVE SAVE-SCALE TO DP-SCALE (DPUB1) MOVE 'N' TO DP-DUP (DPUB1) MOVE ZEROES TO DP-DUP-AT (DPUB1) ELSE DISPLAY ' PI5 - 6 - DPUB1=' DPUB1 DISPLAY ' PI5 - 6.1 - SAVE-PRECISION' SAVE-PRECISION DISPLAY ' PI5 - 6.2 - SAVE-SCALE ' SAVE-SCALE DISPLAY ' PI5 - 6.3 - ' 'DECIMAL-POINTERS(1)' *** DECIMAL-POINTERS(1)
PERFORM VARYING DPUB2
FROM 1 BY 1
UNTIL DPUB2 > DPUB1
OR (SAVE-PRECISION = DP-PRECISION(DPUB2)
AND
SAVE-SCALE = DP-SCALE (DPUB2))
DISPLAY ' PI5 - 6.4 - DPUB2' DPUB2 DISPLAY ' PI5 - 6.5 - ' 'DP-PRECISION(DPUB2)' DP-PRECISION(DPUB2) DISPLAY ' PI5 - 6.6 - ' 'DP-SCALE(DPUB2)' DP-SCALE(DPUB2) END-PERFORM IF DPUB2 > DPUB1
*** DISPLAY ' PI5 - 7'
ADD 1 TO DPUB1
MOVE DPUB1 TO ANA-PTR-TO-DP(ANAB2)
DISPLAY ' PI5 - 7.1 - ANAB2' ANAB2 'ANA-PTR-TO-DP' *** ANA-PTR-TO-DP(ANAB2) MOVE ANAB2 TO DP-ANAB2 (DPUB1) MOVE SAVE-PRECISION TO DP-PRECISION (DPUB1) MOVE SAVE-SCALE TO DP-SCALE (DPUB1) MOVE 'N' TO DP-DUP (DPUB1) MOVE ZEROES TO DP-DUP-AT (DPUB1) ELSE
*** DISPLAY ' PI5 - 8'
ADD 1 TO DPUB1
MOVE DPUB1 TO ANA-PTR-TO-DP(ANAB2)
DISPLAY ' PI5 - 8.1 - ANAB2' ANAB2 'ANA-PTR-TO-DP' *** ANA-PTR-TO-DP(ANAB2) MOVE ANAB2 TO DP-ANAB2 (DPUB1) MOVE SAVE-PRECISION TO DP-PRECISION (DPUB1) MOVE SAVE-SCALE TO DP-SCALE (DPUB1) MOVE 'Y' TO DP-DUP (DPUB1) MOVE DPUB2 TO DP-DUP-AT (DPUB1)
END-IF
END-IF
END-IF
END-PERFORM.
*** DP IS THE DECIMAL POINTER WITH SUBSCRIPTS DPUB1 & DPUB2
DC IS THE DECIMAL CONSTRUCT HOLDING GENERATED WORKING STORAGE LINES AND GENERATED PROCEDURE DIVISION TUP LINES
*** LUMP HOLDS WINE LINES AND TUP PROCEDURE LINES WITH SUBSCRIPT DCUB1
WINE IS A WORKING STORAGE GENERATED LINE AND WUB1 IS THE SUBSCRIPT WINE LINES SHOULD LOOK LIKE
G INDICATES 'GROUP LEVEL' N INDICATES 'NUMERIC' X INDICATES THAT THE NUMERIC FIELD IS REDEFINED AS AN X FIELD 09 IS THE PRECISION 02 IS THE SCALE 07 IS THE PRECISION MINUS THE SCALE AND X(09) IS THE LENGTH DISCOUNTING THE 'V', WHICH IS MERELY AN INDICATOR WHERE THE DECIMAL POINT *** WOULD GO BUT DOESN'T ACTUALLY TAKE UP A BYTE
01 G-09-02. 03 N-09-02 PIC 9(07)V9(02). *** 03 X-09-02 REDEFINES N-09-02 PIC X(09).
THUS MORE THAN ONE DECIMAL FIELD WITH THE SAME PRECISION AND SCALE CAN SHARE THE ABOVE FIELDS, A FLAG IN THE DECIMAL POINTER ARRAY INDICATES DUPlicates AND WHICH ANA ARRAY ELEMENT IS THE ORIGINAL.
DISPLAY ' PI5 - 9 - WINE - DPUB1' DPUB1 PERFORM VARYING DPUB2 FROM 1 BY 1 UNTIL DPUB2 > DPUB1
DISPLAY ' PI5 - 9.1 - DPUB2' DPUB2 MOVE DP-ANAB2(DPUB2) TO ANAB2 DISPLAY ' PI5 - 9.2 - ANAB2' ANAB2
ADD 1 TO DCUB1
DISPLAY ' PI5 - 9.3 - DCUB1' DCUB1
DISPLAY ' PI5 - 9.4 - DP-DUP' DP-DUP(DPUB2) IF DP-DUP(DPUB2) = 'N'
*** DISPLAY ' PI5 - 10 - WINE NOT DUP'
MOVE 1 TO DC-WUB1
MOVE '01' TO DC-WINE(DCUB1,DC-WUB1)(8:2)
MOVE 'G-' TO DC-WINE(DCUB1,DC-WUB1)(12:2)
MOVE DP-PRECISION(DPUB2)
TO DC-WINE(DCUB1,DC-WUB1)(14:2)
MOVE '-' TO DC-WINE(DCUB1,DC-WUB1)(16:1)
MOVE DP-SCALE(DPUB2)
TO DC-WINE(DCUB1,DC-WUB1)(17:2)
MOVE '.' TO DC-WINE(DCUB1,DC-WUB1)(19:1)
MOVE 2 TO DC-WUB1
MOVE '03' TO DC-WINE(DCUB1,DC-WUB1)(12:2)
MOVE 'N-' TO DC-WINE(DCUB1,DC-WUB1)(16:2)
MOVE DP-PRECISION(DPUB2)
TO DC-WINE(DCUB1,DC-WUB1)(18:2)
MOVE '-' TO DC-WINE(DCUB1,DC-WUB1)(20:1)
MOVE DP-SCALE(DPUB2)
TO DC-WINE(DCUB1,DC-WUB1)(21:2)
MOVE 'PIC 9('
TO DC-WINE(DCUB1,DC-WUB1)(24:6)
COMPUTE PP-SS
= DP-PRECISION(DPUB2)
- DP-SCALE (DPUB2)
MOVE PP-SS TO DC-WINE(DCUB1,DC-WUB1)(30:2)
MOVE ')V9(' TO DC-WINE(DCUB1,DC-WUB1)(32:4)
MOVE DP-SCALE(DPUB2)
TO DC-WINE(DCUB1,DC-WUB1)(36:2)
MOVE ').' TO DC-WINE(DCUB1,DC-WUB1)(38:2)
MOVE 3 TO DC-WUB1
MOVE '03' TO DC-WINE(DCUB1,DC-WUB1)(12:2)
MOVE 'X-' TO DC-WINE(DCUB1,DC-WUB1)(16:2)
MOVE DP-PRECISION(DPUB2)
TO DC-WINE(DCUB1,DC-WUB1)(18:2)
MOVE '-' TO DC-WINE(DCUB1,DC-WUB1)(20:1)
MOVE DP-SCALE(DPUB2)
TO DC-WINE(DCUB1,DC-WUB1)(21:2)
MOVE 'REDEFINES'
TO DC-WINE(DCUB1,DC-WUB1)(24:9)
MOVE 'N-' TO DC-WINE(DCUB1,DC-WUB1)(34:2)
MOVE DP-PRECISION(DPUB2)
TO DC-WINE(DCUB1,DC-WUB1)(36:2)
MOVE '-' TO DC-WINE(DCUB1,DC-WUB1)(38:1)
MOVE DP-SCALE(DPUB2)
TO DC-WINE(DCUB1,DC-WUB1)(39:2)
MOVE 'PIC X('
TO DC-WINE(DCUB1,DC-WUB1)(42:6)
MOVE DP-PRECISION(DPUB2)
TO DC-WINE(DCUB1,DC-WUB1)(48:2)
MOVE ').' TO DC-WINE(DCUB1,DC-WUB1)(50:2)
DISPLAY ' '
DISPLAY ' DCUB1 ' DCUB1
DISPLAY ' WINE01' DC-WINE(DCUB1,1)
DISPLAY ' WINE02' DC-WINE(DCUB1,2)
DISPLAY ' WINE03' DC-WINE(DCUB1,3)
DISPLAY ' '
END-IF
============================================================ WE STORE INTO TINE THAT WHICH WILL BE OUTPUT IN TUP OF THE GENERATED PROGRAM (IIPPPPSS), WHERE II are one's intials, PPPP are an abbreviated form of the target program name and SS is the SQL sequence number whose host variables we are filling from DB2. Thus IIPPPPSS might be JHTES203 and the generated program would have an extension of CBL. DB2CRE8 uses JHTES2YY.CBL as a template filling in the gaps as appropriate. *** ============================================================
*** DISPLAY ' PI5 - 11 - TINE'
IF ANA-RIGHT(ANAB2) NOT = SPACES
DISPLAY ' PI5 - 12 - ' ANAB2 *** 'R NOT SPACES'
MOVE 1 TO DC-TUB1
MOVE DCUB1 TO ANA-PTR-TO-DC(ANAB2)
DISPLAY ' PI5 -12.1 - ANAB2' ANAB2 'ANA-PTR-TO-DC' *** ANA-PTR-TO-DC(ANAB2)
MOVE 'IF ANO-COUNT = ' TO DC-TINE(DCUB1,DC-TUB1)
(12:15)
MOVE ANAB2 TO DC-TINE(DCUB1,DC-TUB1)
(27:2)
MOVE 2 TO DC-TUB1
MOVE 'IF INULL = ''Y''' TO DC-TINE(DCUB1,DC-TUB1)
(16:14)
MOVE 3 TO DC-TUB1
MOVE 'MOVE -1 TO ' TO DC-TINE(DCUB1,DC-TUB1)
(20:11)
MOVE ANA-RIGHT(ANAB2) TO DC-TINE(DCUB1,DC-TUB1)
(31:31)
MOVE 4 TO DC-TUB1
MOVE 'ELSE' TO DC-TINE(DCUB1,DC-TUB1)
(16:4)
MOVE 5 TO DC-TUB1
MOVE 'MOVE ZERO TO ' TO DC-TINE(DCUB1,DC-TUB1)
(20:13)
MOVE ANA-RIGHT(ANAB2) TO DC-TINE(DCUB1,DC-TUB1)
(33:31)
MOVE 6 TO DC-TUB1
MOVE 'MOVE ZEROES TO' TO DC-TINE(DCUB1,DC-TUB1)
(20:14)
MOVE ANA-LEFT(ANAB2) TO DC-TINE(DCUB1,DC-TUB1)
(35:31)
*** MOVE ZEROES TO ana-left(anab2)
MOVE 7 TO DC-TUB1
MOVE 'MOVE THE-LEFT(' TO DC-TINE(DCUB1,DC-TUB1)
(20:14)
COMPUTE PP-SS = DP-PRECISION(DPUB2) - DP-SCALE(DPUB2)
COMPUTE THIRTY2-PP-SS
= 32 - PP-SS
MOVE THIRTY2-PP-SS TO DC-TINE(DCUB1,DC-TUB1)
(34:2)
MOVE ':' TO DC-TINE(DCUB1,DC-TUB1)
(36:1)
MOVE PP-SS TO DC-TINE(DCUB1,DC-TUB1)
(37:2)
MOVE ')' TO DC-TINE(DCUB1,DC-TUB1)
(39:1)
*** MOVE THE-LEFT(32 - (pp - ss):(pp - ss))
MOVE 8 TO DC-TUB1
MOVE 'TO X-' TO DC-TINE(DCUB1,DC-TUB1)
(22:5)
MOVE DP-PRECISION(DPUB2)
TO DC-TINE(DCUB1,DC-TUB1)
(27:2)
MOVE '-' TO DC-TINE(DCUB1,DC-TUB1)
(29:1)
MOVE DP-SCALE(DPUB2) TO DC-TINE(DCUB1,DC-TUB1)
(30:2)
MOVE '(1:' TO DC-TINE(DCUB1,DC-TUB1)
(32:3)
MOVE PP-SS TO DC-TINE(DCUB1,DC-TUB1)
(35:2)
MOVE ')' TO DC-TINE(DCUB1,DC-TUB1)
(37:1)
*** TO X-pp-ss(1:(pp - ss))
MOVE 9 TO DC-TUB1
COMPUTE PP-SS-PLUS-1 = PP-SS + 1
MOVE 'MOVE THE-RIGHT(01:'
TO DC-TINE(DCUB1,DC-TUB1)
(20:18)
MOVE DP-SCALE(DPUB2) TO DC-TINE(DCUB1,DC-TUB1)
(38:2)
MOVE ')' TO DC-TINE(DCUB1,DC-TUB1)
(40:1)
*** MOVE THE-RIGHT(1:ss)
MOVE 10 TO DC-TUB1
MOVE 'TO X-' TO DC-TINE(DCUB1,DC-TUB1)
(22:5)
MOVE DP-PRECISION(DPUB2)
TO DC-TINE(DCUB1,DC-TUB1)
(27:2)
MOVE '-' TO DC-TINE(DCUB1,DC-TUB1)
(29:1)
MOVE DP-SCALE(DPUB2) TO DC-TINE(DCUB1,DC-TUB1)
(30:2)
MOVE '(' TO DC-TINE(DCUB1,DC-TUB1)
(32:1)
MOVE PP-SS-PLUS-1 TO DC-TINE(DCUB1,DC-TUB1)
(33:2)
MOVE ':' TO DC-TINE(DCUB1,DC-TUB1)
(35:1)
MOVE DP-SCALE(DPUB2) TO DC-TINE(DCUB1,DC-TUB1)
(36:2)
MOVE ')' TO DC-TINE(DCUB1,DC-TUB1)
(38:1)
*** TO X-pp-ss(1:ss)
MOVE 11 TO DC-TUB1
MOVE 'IF MINUS-SIGN-COUNT = 0'
TO DC-TINE(DCUB1,DC-TUB1)
(20:23)
*** IF MINUS-SIGN-COUNT = 0
MOVE 12 TO DC-TUB1
MOVE 'MOVE N-' TO DC-TINE(DCUB1,DC-TUB1)
(24:7)
MOVE DP-PRECISION(DPUB2)
TO DC-TINE(DCUB1,DC-TUB1)
(31:2)
MOVE '-' TO DC-TINE(DCUB1,DC-TUB1)
(33:1)
MOVE DP-SCALE(DPUB2) TO DC-TINE(DCUB1,DC-TUB1)
(34:2)
MOVE 'TO' TO DC-TINE(DCUB1,DC-TUB1)
(37:2)
MOVE ANA-LEFT(ANAB2) TO DC-TINE(DCUB1,DC-TUB1)
(40:31)
*** MOVE N-pp-ss to ana-left(anab2)
MOVE 13 TO DC-TUB1
MOVE 'ELSE' TO DC-TINE(DCUB1,DC-TUB1)
(20:4)
*** ELSE
MOVE 14 TO DC-TUB1
MOVE 'COMPUTE' TO DC-TINE(DCUB1,DC-TUB1)
(24:7)
MOVE ANA-LEFT(ANAB2) TO DC-TINE(DCUB1,DC-TUB1)
(32:31)
MOVE 15 TO DC-TUB1
MOVE '= 0 - ' TO DC-TINE(DCUB1,DC-TUB1)
(30:7)
MOVE 'N-' TO DC-TINE(DCUB1,DC-TUB1)
(37:2)
MOVE DP-PRECISION(DPUB2)
TO DC-TINE(DCUB1,DC-TUB1)
(39:2)
MOVE '-' TO DC-TINE(DCUB1,DC-TUB1)
(41:1)
MOVE DP-SCALE(DPUB2) TO DC-TINE(DCUB1,DC-TUB1)
(42:2)
*** = 0 - N-09-02
MOVE 16 TO DC-TUB1
MOVE 'END-IF' TO DC-TINE(DCUB1,DC-TUB1)
(20:6)
MOVE 17 TO DC-TUB1
MOVE 'END-IF' TO DC-TINE(DCUB1,DC-TUB1)
(16:6)
*** END-IF
MOVE 18 TO DC-TUB1
MOVE 'END-IF' TO DC-TINE(DCUB1,DC-TUB1)
(12:6)
*** END-IF
DISPLAY ' '
DISPLAY ' DCUB1 ' DCUB1
DISPLAY ' TINE01' DC-TINE(DCUB1,1)
DISPLAY ' TINE02' DC-TINE(DCUB1,2)
DISPLAY ' TINE03' DC-TINE(DCUB1,3)
DISPLAY ' TINE04' DC-TINE(DCUB1,4)
DISPLAY ' TINE05' DC-TINE(DCUB1,5)
DISPLAY ' TINE06' DC-TINE(DCUB1,6)
DISPLAY ' TINE07' DC-TINE(DCUB1,7)
DISPLAY ' TINE08' DC-TINE(DCUB1,8)
DISPLAY ' TINE09' DC-TINE(DCUB1,9)
DISPLAY ' TINE10' DC-TINE(DCUB1,10)
DISPLAY ' TINE11' DC-TINE(DCUB1,11)
DISPLAY ' TINE12' DC-TINE(DCUB1,12)
DISPLAY ' TINE13' DC-TINE(DCUB1,13)
DISPLAY ' TINE14' DC-TINE(DCUB1,14)
DISPLAY ' TINE15' DC-TINE(DCUB1,15)
DISPLAY ' TINE16' DC-TINE(DCUB1,16)
DISPLAY ' TINE17' DC-TINE(DCUB1,17)
DISPLAY ' TINE18' DC-TINE(DCUB1,18)
DISPLAY ' TINE19' DC-TINE(DCUB1,19)
DISPLAY ' TINE20' DC-TINE(DCUB1,20)
DISPLAY ' '
ELSE
DISPLAY ' PI5 - 13 - ' ANAB2 *** 'R SPACES' MOVE 1 TO DC-TUB1
MOVE DCUB1 TO ANA-PTR-TO-DC(ANAB2)
DISPLAY ' PI5 - 13.1 - ANAB2' ANAB2 'ANA-PTR-TO-DC' *** ANA-PTR-TO-DC(ANAB2)
MOVE 'IF ANO-COUNT = ' TO DC-TINE(DCUB1,DC-TUB1)
(12:15)
MOVE ANAB2 TO DC-TINE(DCUB1,DC-TUB1)
(27:2)
MOVE 2 TO DC-TUB1
MOVE 'MOVE ZEROES TO' TO DC-TINE(DCUB1,DC-TUB1)
(16:14)
MOVE ANA-LEFT(ANAB2) TO DC-TINE(DCUB1,DC-TUB1)
(35:31)
*** MOVE ZEROES TO ana-left(anab2)
MOVE 3 TO DC-TUB1
MOVE 'MOVE THE-LEFT(' TO DC-TINE(DCUB1,DC-TUB1)
(16:14)
COMPUTE PP-SS = DP-PRECISION(DPUB2) - DP-SCALE(DPUB2)
COMPUTE THIRTY2-PP-SS
= 32 - PP-SS
MOVE THIRTY2-PP-SS TO DC-TINE(DCUB1,DC-TUB1)
(30:2)
MOVE ':' TO DC-TINE(DCUB1,DC-TUB1)
(32:1)
MOVE PP-SS TO DC-TINE(DCUB1,DC-TUB1)
(33:2)
MOVE ')' TO DC-TINE(DCUB1,DC-TUB1)
(35:1)
*** MOVE THE-LEFT(32 - (pp - ss):(pp - ss))
MOVE 4 TO DC-TUB1
MOVE 'TO X-' TO DC-TINE(DCUB1,DC-TUB1)
(18:5)
MOVE DP-PRECISION(DPUB2)
TO DC-TINE(DCUB1,DC-TUB1)
(23:2)
MOVE '-' TO DC-TINE(DCUB1,DC-TUB1)
(25:1)
MOVE DP-SCALE(DPUB2) TO DC-TINE(DCUB1,DC-TUB1)
(26:2)
MOVE '(1:' TO DC-TINE(DCUB1,DC-TUB1)
(28:3)
MOVE PP-SS TO DC-TINE(DCUB1,DC-TUB1)
(31:2)
MOVE ')' TO DC-TINE(DCUB1,DC-TUB1)
(33:1)
*** TO X-pp-ss(1:(pp - ss))
MOVE 5 TO DC-TUB1
COMPUTE PP-SS-PLUS-1 = PP-SS + 1
MOVE 'MOVE THE-RIGHT(01:'
TO DC-TINE(DCUB1,DC-TUB1)
(16:18)
MOVE DP-SCALE(DPUB2) TO DC-TINE(DCUB1,DC-TUB1)
(34:2)
MOVE ')' TO DC-TINE(DCUB1,DC-TUB1)
(36:1)
*** MOVE THE-RIGHT(1:ss)
MOVE 6 TO DC-TUB1
MOVE 'TO X-' TO DC-TINE(DCUB1,DC-TUB1)
(18:5)
MOVE DP-PRECISION(DPUB2)
TO DC-TINE(DCUB1,DC-TUB1)
(23:2)
MOVE '-' TO DC-TINE(DCUB1,DC-TUB1)
(25:1)
MOVE DP-SCALE(DPUB2) TO DC-TINE(DCUB1,DC-TUB1)
(26:2)
MOVE '(' TO DC-TINE(DCUB1,DC-TUB1)
(28:1)
MOVE PP-SS-PLUS-1 TO DC-TINE(DCUB1,DC-TUB1)
(29:2)
MOVE ':' TO DC-TINE(DCUB1,DC-TUB1)
(31:1)
MOVE DP-SCALE(DPUB2) TO DC-TINE(DCUB1,DC-TUB1)
(32:2)
MOVE ')' TO DC-TINE(DCUB1,DC-TUB1)
(34:1)
*** TO X-pp-ss(1:ss)
MOVE 7 TO DC-TUB1
MOVE 'IF MINUS-SIGN-COUNT = 0'
TO DC-TINE(DCUB1,DC-TUB1)
(16:23)
*** IF MINUS-SIGN-COUNT = 0
MOVE 8 TO DC-TUB1
MOVE 'MOVE N-' TO DC-TINE(DCUB1,DC-TUB1)
(20:7)
MOVE DP-PRECISION(DPUB2)
TO DC-TINE(DCUB1,DC-TUB1)
(27:2)
MOVE '-' TO DC-TINE(DCUB1,DC-TUB1)
(29:1)
MOVE DP-SCALE(DPUB2) TO DC-TINE(DCUB1,DC-TUB1)
(30:2)
MOVE 'TO' TO DC-TINE(DCUB1,DC-TUB1)
(33:2)
MOVE ANA-LEFT(ANAB2) TO DC-TINE(DCUB1,DC-TUB1)
(36:31)
*** MOVE N-pp-ss to ana-left(anab2)
MOVE 9 TO DC-TUB1
MOVE 'ELSE' TO DC-TINE(DCUB1,DC-TUB1)
(16:4)
*** ELSE
MOVE 10 TO DC-TUB1
MOVE 'COMPUTE' TO DC-TINE(DCUB1,DC-TUB1)
(20:7)
MOVE ANA-LEFT(ANAB2) TO DC-TINE(DCUB1,DC-TUB1)
(28:31)
MOVE 11 TO DC-TUB1
MOVE '= 0 - ' TO DC-TINE(DCUB1,DC-TUB1)
(26:7)
MOVE 'N-' TO DC-TINE(DCUB1,DC-TUB1)
(33:2)
MOVE DP-PRECISION(DPUB2)
TO DC-TINE(DCUB1,DC-TUB1)
(35:2)
MOVE '-' TO DC-TINE(DCUB1,DC-TUB1)
(37:1)
MOVE DP-SCALE(DPUB2) TO DC-TINE(DCUB1,DC-TUB1)
(38:2)
*** = 0 - N-09-02
MOVE 12 TO DC-TUB1
MOVE 'END-IF' TO DC-TINE(DCUB1,DC-TUB1)
(16:6)
MOVE 13 TO DC-TUB1
MOVE 'END-IF' TO DC-TINE(DCUB1,DC-TUB1)
(12:6)
DISPLAY ' '
DISPLAY ' DCUB1 ' DCUB1
DISPLAY ' TINE01' DC-TINE(DCUB1,1)
DISPLAY ' TINE02' DC-TINE(DCUB1,2)
DISPLAY ' TINE03' DC-TINE(DCUB1,3)
DISPLAY ' TINE04' DC-TINE(DCUB1,4)
DISPLAY ' TINE05' DC-TINE(DCUB1,5)
DISPLAY ' TINE06' DC-TINE(DCUB1,6)
DISPLAY ' TINE07' DC-TINE(DCUB1,7)
DISPLAY ' TINE08' DC-TINE(DCUB1,8)
DISPLAY ' TINE09' DC-TINE(DCUB1,9)
DISPLAY ' TINE10' DC-TINE(DCUB1,10)
DISPLAY ' TINE11' DC-TINE(DCUB1,11)
DISPLAY ' TINE12' DC-TINE(DCUB1,12)
DISPLAY ' TINE13' DC-TINE(DCUB1,13)
DISPLAY ' TINE14' DC-TINE(DCUB1,14)
DISPLAY ' TINE15' DC-TINE(DCUB1,15)
DISPLAY ' TINE16' DC-TINE(DCUB1,16)
DISPLAY ' TINE17' DC-TINE(DCUB1,17)
DISPLAY ' TINE18' DC-TINE(DCUB1,18)
DISPLAY ' TINE19' DC-TINE(DCUB1,19)
DISPLAY ' TINE20' DC-TINE(DCUB1,20)
*** DISPLAY ' '
END-IF
END-PERFORM.
*** DISPLAY ' PI5 - 14'.
*** WRITE TO WORKING STORAGE FROM WINE
PERFORM VARYING DCUB2
FROM 1 BY 1
UNTIL DCUB2 > DCUB1
PERFORM VARYING DC-WUB2
FROM 1 BY 1
UNTIL DC-WUB2 > 3
IF DC-WINE(DCUB2,DC-WUB2)
NOT = SPACES
MOVE DC-WINE(DCUB2,DC-WUB2)
TO OUT-RECORD
PERFORM WRITE-OUT-RECORD
END-IF
END-PERFORM
END-PERFORM.
*** DISPLAY ' PI5 - 15 - EXIT'.
PI05X. EXIT.
READ-INITS-FILE SECTION.
READ INITS-FILE
AT END
MOVE 'Y' TO INITS-EOF
GO RINITSFX
END-READ.
RINITSFX. EXIT.
READ-PID-FILE SECTION.
READ PID-FILE
AT END
MOVE 'Y' TO PID-EOF
GO RPFX
END-READ.
RPFX. EXIT.
READ-SEQ-FILE SECTION.
READ SEQ-FILE
AT END
MOVE 'Y' TO SEQ-EOF
GO RSFX
END-READ.
RSFX. EXIT.
READ-ANOTHER-INTO-FILE SECTION.
READ-ANOTHER-INTO-AGAIN.
READ ANOTHER-INTO-FILE
AT END
MOVE 'Y' TO ANO-EOF
GO RAFX
END-READ.
IF ANO-EOF = 'N'
MOVE 'N' TO ANO-FIRST
IF ANO-SEQ = SEQ-1-TO-2
ADD 1 TO ANAB1
MOVE ANO-RECORD
TO ANA-ARRAY(ANAB1)
GO READ-ANOTHER-INTO-AGAIN
ELSE
GO READ-ANOTHER-INTO-AGAIN
END-IF
END-IF.
RAFX. EXIT.
READ-IN-FILE SECTION.
READ-IN-AGAIN.
READ IN-FILE
AT END
MOVE 'Y' TO IN-EOF
GO RIFX
END-READ.
IF IN-EOF = 'N'
IF IN-1-TO-2 = ' '
MOVE IN-RECORD TO OUT-RECORD
PERFORM WRITE-OUT-RECORD
GO READ-IN-AGAIN
END-IF
END-IF.
RIFX. EXIT.
READ-IN-FILE2 SECTION.
READ IN-FILE2
AT END
MOVE 'Y' TO IN-EOF2
GO RIF2X END-READ. IF IN-EOF2 = 'N' DISPLAY 'READ-IN-FILE2' IN-RECORD2 ELSE DISPLAY 'READ-IN-FILE2 FINISHED' *** END-IF.
RIF2X. EXIT.
WRITE-OUT-RECORD SECTION.
WRITE OUT-RECORD.
WORX. EXIT.
BOMB SECTION.
MOVE 16 TO RETURN-CODE.
STOP RUN.
BX. EXIT.
IDENTIFICATION DIVISION.
PROGRAM-ID. SQUELCH5.
*** ===========================================================================
*** SQUELCH5 replaced SQUELCH4 on 13/11/22 by JCLH
SQUELCH4 was too slow and it wouldn't deal with multiple sub-selects, unions, joins, nested table expressions (NTE), common table expressions (CTE).
All it really needs to do is substitute values for :parameters and put the results back into fields of the target program.
*** ===========================================================================
*** SQUELCH5 replaced SQUELCH on 21/10/22 by JCLH
I found that I couldn't guarantee that I could update a VIEW and the under- lying TABLE(s). So processing to CREATE and use the VIEW will be removed.
I have created an USER-DEFINED FUNCTION for each datatype. So the existing generated SQL will all have to be rewritten.
*** ===========================================================================
IBM normally passes a cobol program (extension of SQB) that has DB2 embedded SQL thru a DB2 preprocessor step which creates a CBL version, replacing the *** EXEC SQL constructs with CALLs to C modules within the DB2API DLL.
Z390 doesn't support that type of CALL, so a pair of zcobol programs, DB2PREPY/DB2PREPZ were created, which replace EXEC SQL constructs with CALLs *** to SQUELCH5.cbl.
=========================================================================== ===========================================================================
*** SQUELCH5 replaced SQUELCH on 21/10/22 by JCLH
I found that I couldn't guarantee that I could update a VIEW and the under- lying TABLE(s). So processing to CREATE and use the VIEW will be removed.
I have created an USER-DEFINED FUNCTION for each datatype. So the existing generated SQL will all have to be rewritten.
SQUELCH5 is the SQL Command Handler for embedded DB2 SQL zcobol programs ___
SQUELCH5 takes embedded SQL commands from the calling zcobol program and converts them for use by DB2 CLP (Command Line Processor).
Basically it comments-out the "INTO" clause from SELECT INTO and FETCH INTO commands.
It also replaces remaining host variables (those starting :) in all SQL statements with the actual values from the calling program, at run time.
During compilation of the calling program, all Working Storage fields, have their details stored in the ERR file, using a modified WS.MAC routine.
SQL commands are run within DB2 CLP by submission thru modified CMDPROC assembler.
*** (start1/wread1/stop1,
*** start1 being run once, initially,
wread1 is invoked each time an SQL command is to be processed,
(It submits the SQL request, as a DB2 batch command, and reads any subsequent
*** output.)
*** stop1 being run once, after all SQL has been processed).
We store any received values, into the Working Storage fields, in the calling program, via the fields identified in the stripped "INTO" clauses.
A field called EYECATCHER will be inserted as the 1st field in the Working Storage Section of the Target Program, which will be passed as one of the linkage *** parameters to SQUELCH5.
We know the names of the Target host variables (from the "INTO" CLAUSE). We can obtain the address of EYECATCHER from the ERR file. We can obtain the addresses of the Target host variables from their names and from the ERR file. Subtracting the address of EYECATCHER from the addresses of the Target host variables gives values that can be used as subscripts from EYECATCHER in SQUELCH5. Thus the values can be stored directly into the Target Programs *** host variables.
Connection to the DB2 database is retained between separate invocations of wread1.
*** SQUELCH5 should be able to support all SQL commands that CLP supports.
A commit will be effected when the DB2 CONNECT RESET is processed or it may be done using the "-c" flag when SQUELCH5 runs the DB2 request. *** This will need to be resolved at a later stage.
*** ===========================================================================
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT DATABASE-FILE
ASSIGN TO DATABASE
ORGANIZATION IS LINE SEQUENTIAL.
SELECT DISPLAY-FILE
ASSIGN TO DISPFILE
ORGANIZATION IS LINE SEQUENTIAL.
SELECT ERR-FILE
ASSIGN TO ERRFILE
ORGANIZATION IS LINE SEQUENTIAL.
SELECT SQL-RESULT-FILE
ASSIGN TO SQLRES
ORGANIZATION IS LINE SEQUENTIAL.
SELECT SQL-FILE
ASSIGN TO SQLFILE
ORGANIZATION IS LINE SEQUENTIAL.
SELECT SQL-IN-FILE
ASSIGN TO SQLIN
ORGANIZATION IS LINE SEQUENTIAL.
DATA DIVISION.
FILE SECTION.
FD DATABASE-FILE
DATA RECORD IS DATABASE-RECORD.
01 DATABASE-RECORD PIC X(80).
FD DISPLAY-FILE
DATA RECORD IS DISPLAY-RECORD.
01 DISPLAY-RECORD.
03 DISPLAY-RECORD-1-TO-5 PIC X(05).
03 PIC X(75).
FD ERR-FILE
DATA RECORD IS ERR-RECORD.
01 ERR-RECORD PIC X(255).
FD SQL-IN-FILE
DATA RECORD IS SQL-IN-RECORD.
01 SQL-IN-RECORD.
03 SQL-IN-RECORD1 PIC X(50).
03 SQL-IN-RECORD2 PIC X(50).
FD SQL-FILE
DATA RECORD IS SQL-RECORD.
01 SQL-RECORD.
03 SQL-RECORD-1-TO-7.
05 SQL-RECORD-1-TO-6.
07 SQL-RECORD-1-TO-3.
09 SQL-RECORD-1-TO-1 PIC X(01).
09 PIC X(02).
07 PIC X(03).
05 SQL-RECORD-7-TO-7 PIC X(01).
03 PIC X(58).
FD SQL-RESULT-FILE
DATA RECORD IS SQL-RESULT-RECORD.
01 SQL-RESULT-RECORD.
03 SRR120 PIC X(120).
03 FILLER PIC X(64880).
WORKING-STORAGE SECTION.
01 EOF-DATABASE PIC X(01).
01 NOT-COMMA PIC X(01).
01 THE-RETURNS PIC 9(02).
01 THE-PRECISION PIC 9(02).
01 THE-SCALE PIC 9(02).
01 SELECT-ASTERISK PIC X(01).
01 BRACKET-COUNT PIC S9(04) COMP.
01 STOP-MET PIC X(01).
01 COMMA-FOUND PIC X(01).
01 TIPE PIC X(07).
01 CURSOR-NAME PIC X(70).
01 CURSOR-FOUND PIC X(01).
01 CHUNK-NEXT PIC 9(05).
01 CHUNK-THIS PIC 9(05).
01 MINUS-1 PIC S9(04) COMP VALUE -1.
01 FILLER REDEFINES MINUS-1.
03 MINUS1-1 PIC X(01).
03 MINUS1-2 PIC X(01).
01 DUMMY PIC X(01) VALUE SPACE.
01 FORCHAR PIC X(04).
01 SQL-IN-FILE-EOF PIC X(01).
01 WS-TILDE PIC X(01) VALUE '~'.
01 YY-FOUND PIC X(01).
01 ZZ-FOUND PIC X(01).
01 ZTART PIC 9(05).
01 ZTART-PLUS PIC 9(05).
01 POYNTER PIC 9(05).
01 POYNTER-PLUS PIC 9(02).
01 SIXTY4CHAR PIC X(64).
01 COUNT3 PIC 9(03).
01 FILLER REDEFINES COUNT3.
03 COUNT3X PIC X(03).
01 TWOGETHER PIC 9(04) COMP.
01 FILLER REDEFINES TWOGETHER.
03 FILLER PIC X(01) VALUE LOW-VALUE.
03 SECUND PIC X(01).
01 HEX-PAIR.
03 HEX-PAIR1 PIC X(01).
03 HEX-PAIR2 PIC X(01).
01 LENTH PIC 9(04).
01 LENTH-PLUS-1 PIC 9(04).
01 KWOTE PIC X(01) VALUE ''''.
01 DISPLAY-ARRAYS.
03 DISPLAY-ARRAY PIC X(80) OCCURS 10.
01 DFUB1 PIC S9(04) COMP.
01 DFUB2 PIC S9(04).
01 NINE04-ZEROES PIC 9(04).
01 MATCH-FOUND PIC X(01).
01 LUMP PIC X(80).
01 DUM1 PIC 9(04).
01 COLON-COUNT PIC S9(04) COMP.
01 COLON-ATS.
03 COLON-AT PIC S9(04) COMP OCCURS 9.
01 SPACE-ATS.
03 SPACE-AT PIC S9(04) COMP OCCURS 9.
01 NAYME PIC X(31).
01 INTO-ARRAYSS.
03 INTO-ARRAYS OCCURS 99.
05 INTO-ARRAY.
07 INTO-ARRAY-BYTE PIC X(01) OCCURS 31.
05 INTO-ARRAY-PTR PIC S9(04) COMP.
05 INTO-IV-ARRAY.
07 INTO-IV-ARRAY-BYTE PIC X(01) OCCURS 31.
05 INTO-IV-ARRAY-PTR PIC S9(04) COMP.
01 INTUB1 PIC S9(04) COMP.
01 INTUB2 PIC S9(04) COMP.
01 INCUB1 PIC S9(04) COMP.
01 INCUB2 PIC S9(04) COMP.
01 BEEGIN PIC S9(04) COMP.
01 PHOR1 PIC S9(04) COMP.
01 PHOR2 PIC S9(04) COMP.
01 SQL-ARRAYSS.
03 SQL-ARRAYS OCCURS 99.
05 SQL-ARRAY.
07 SQL-ARRAY-1-TO-1 PIC X(01).
07 SQL-ARRAY-2-TO-32 PIC X(31).
07 PIC X(38).
01 SQUB1 PIC S9(04) COMP.
01 SQUB2 PIC S9(04) COMP.
01 SQUB3 PIC S9(04) COMP.
01 SQUB4 PIC S9(04) COMP.
01 SQUB5 PIC S9(04) COMP.
01 SQUB6 PIC S9(04) COMP.
01 SQUB7 PIC S9(04) COMP.
01 SQUB8 PIC S9(04) COMP.
01 SQUB12 PIC S9(04) COMP.
01 SQUB13 PIC S9(04) COMP.
01 SQUB14 PIC S9(04) COMP.
01 SQUB21 PIC S9(04) COMP.
01 SQUB22 PIC S9(04) COMP.
01 SQUB23 PIC S9(04) COMP.
01 SQUB24 PIC S9(04) COMP.
01 SQUB25 PIC S9(04) COMP.
01 SQUB26 PIC S9(04) COMP.
01 SQUB27 PIC S9(04) COMP.
01 SQUC1 PIC S9(04) COMP.
01 SQUC2 PIC S9(04) COMP.
01 FIRST-TIME-THRU PIC X(01) VALUE 'Y'.
01 STORED-ARRAYSS.
03 STORED-ARRAYS OCCURS 99.
05 STORED-ARRAY PIC X(70).
01 STAB1 PIC S9(04) COMP.
01 STAB2 PIC S9(04) COMP.
01 SAVE-SQL-ARRAYSS.
03 SAVE-SQL-ARRAYS OCCURS 99.
05 SAVE-SQL-ARRAY.
07 SAVE-SQL-ARRAY-1-TO-1 PIC X(01).
07 SAVE-SQL-ARRAY-2-TO-32 PIC X(31).
07 PIC X(38).
01 SSQUB1 PIC S9(04) COMP.
01 COLUMN-INFO-FOUND PIC X(01) VALUE 'N'.
01 TABLE-INFO-FOUND PIC X(01) VALUE 'N'.
01 THE-SQL-INFOSS.
03 THE-SQL-INFO OCCURS 99.
05 THE-SQL-COLUMN-NAME.
07 THE-SQL-COLUMN-NAME-1 PIC X(01).
07 FILLER PIC X(30).
05 THE-SQL-TYPE.
07 THE-SQL-TYPE9 PIC 9(03).
05 THE-SQL-TYPE-LITERAL PIC X(14).
05 THE-SQL-TYPE-LENGTH.
07 THE-SQL-TYPE-LENGTH9 PIC 9(02).
05 THE-SQL-TYPE-SCALE.
07 THE-SQL-TYPE-SCALE9 PIC 9(02).
01 COLUB1 PIC 9(04).
01 COLUB2 PIC 9(04).
01 NUM-COLUB2 PIC 9(04).
01 SAVE-SQUB2-START PIC 9(04).
01 SAVE-SQUB2-END PIC 9(04).
01 NOF-COLUMNS-FOUND PIC X(01).
01 NOF-COLUMNS-X.
03 NOF-COLUMNS PIC 9(06).
01 TOO PIC 9(08).
01 TOOP PIC 9(08).
01 FROMM PIC 9(08).
01 NINE-TEN PIC 9(10).
01 S-NINE4-COMP PIC S9(04) COMP.
01 ADDRESS-OF-EYECATCHER.
03 ADDRESS-OF-EYECATCHER9 PIC 9(08).
01 WSSS.
03 WSS OCCURS 200.
05 WS-DATA PIC X(31).
05 WS-LVL PIC X(02).
05 WS-ADDR.
07 WS-ADDR9 PIC 9(08).
05 WS-LEN.
07 WS-LEN9 PIC 9(08).
05 WS-PIC PIC X(08).
05 WS-PIC-TYP PIC X(01).
05 WS-PIC-SIGN PIC X(01).
05 WS-PIC-DEC PIC X(01).
01 WSUB1 PIC S9(04) COMP.
01 WSUB2 PIC S9(04) COMP.
01 WSUB3 PIC S9(04) COMP.
01 WSUB4 PIC S9(04) COMP.
01 WSUB5 PIC S9(04) COMP.
01 DIGIT-FOUND PIC X(01).
01 SAVE-ADDR PIC X(08).
01 SAVE-LEN PIC X(08).
01 ADUB1 PIC S9(04).
01 ADUB2 PIC S9(04).
01 ADUB3 PIC S9(04).
01 SPACE-FOUND PIC X(01).
01 VARCH-LEN PIC 9(05) VALUE 0.
01 SQL-FILE-ENDED PIC X(01) VALUE 'N'.
01 DISPLAY-FILE-ENDED PIC X(01) VALUE 'N'.
01 SQL-RESULT-FILE-ENDED PIC X(01) VALUE 'N'.
01 ERR-FILE-ENDED PIC X(01) VALUE 'N'.
01 STORESS.
03 STORES OCCURS 8.
05 STORE PIC X(32).
01 STUB1 PIC 9(04).
01 kount pic 9(04).
01 kount2 pic 9(04).
01 SQRUB1 pic S9(04).
01 SQRUB2 pic S9(04).
01 SQRUB3 pic S9(04).
01 SQRUB4 pic S9(04).
01 PRUB1 PIC S9(04).
01 PRUB2 PIC 9(04).
01 PRUB3 PIC 9(04).
01 PRUB4 PIC 9(04).
01 WS-CHARS.
03 SEVENTEENCHAR PIC X(17).
03 FILLER REDEFINES SEVENTEENCHAR.
05 FOURTEENCHAR PIC X(14).
05 FILLER PIC X(03).
03 FILLER REDEFINES SEVENTEENCHAR.
05 THIRTEENCHAR PIC X(13).
05 FILLER PIC X(04).
03 FILLER REDEFINES SEVENTEENCHAR.
05 TWELVECHAR PIC X(12).
05 FILLER PIC X(05).
03 FILLER REDEFINES SEVENTEENCHAR.
05 ELEVENCHAR PIC X(11).
05 FILLER PIC X(06).
03 FILLER REDEFINES SEVENTEENCHAR.
05 TENCHAR PIC X(10).
05 FILLER PIC X(07).
03 FILLER REDEFINES SEVENTEENCHAR.
05 NINECHAR PIC X(09).
05 FILLER PIC X(08).
03 FILLER REDEFINES SEVENTEENCHAR.
05 EIGHTCHAR PIC X(08).
05 FILLER PIC X(09).
03 FILLER REDEFINES SEVENTEENCHAR.
05 SEVENCHAR PIC X(07).
05 FILLER PIC X(10).
03 FILLER REDEFINES SEVENTEENCHAR.
05 SIXCHAR PIC X(06).
05 FILLER PIC X(11).
03 FILLER REDEFINES SEVENTEENCHAR.
05 FIVECHAR PIC X(05).
05 FILLER PIC X(12).
03 FILLER REDEFINES SEVENTEENCHAR.
05 FOURCHAR PIC X(04).
05 FILLER PIC X(13).
03 FILLER REDEFINES SEVENTEENCHAR.
05 THREECHAR PIC X(03).
05 FILLER PIC X(14).
03 FILLER REDEFINES SEVENTEENCHAR.
05 TWOCHAR PIC X(02).
05 FILLER PIC X(15).
03 FILLER REDEFINES SEVENTEENCHAR.
05 ONECHAR PIC X(01).
05 FILLER PIC X(16).
01 NINETEENCHAR PIC X(19).
01 syne pic x(01).
01 ASCIIS.
03 ASCIIS.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE ' '.
05 FILLER PIC X(01) VALUE '!'.
05 FILLER PIC X(01) VALUE '"'.
05 FILLER PIC X(01) VALUE '#'.
05 FILLER PIC X(01) VALUE '$'.
05 FILLER PIC X(01) VALUE '%'.
05 FILLER PIC X(01) VALUE '&'.
05 FILLER PIC X(01) VALUE ''''.
05 FILLER PIC X(01) VALUE '('.
05 FILLER PIC X(01) VALUE ')'.
05 FILLER PIC X(01) VALUE '*'.
05 FILLER PIC X(01) VALUE '+'.
05 FILLER PIC X(01) VALUE ','.
05 FILLER PIC X(01) VALUE '-'.
05 FILLER PIC X(01) VALUE '.'.
05 FILLER PIC X(01) VALUE '/'.
05 FILLER PIC X(01) VALUE '0'.
05 FILLER PIC X(01) VALUE '1'.
05 FILLER PIC X(01) VALUE '2'.
05 FILLER PIC X(01) VALUE '3'.
05 FILLER PIC X(01) VALUE '4'.
05 FILLER PIC X(01) VALUE '5'.
05 FILLER PIC X(01) VALUE '6'.
05 FILLER PIC X(01) VALUE '7'.
05 FILLER PIC X(01) VALUE '8'.
05 FILLER PIC X(01) VALUE '9'.
05 FILLER PIC X(01) VALUE ':'.
05 FILLER PIC X(01) VALUE ';'.
05 FILLER PIC X(01) VALUE '<'.
05 FILLER PIC X(01) VALUE '='.
05 FILLER PIC X(01) VALUE '>'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '@'.
05 FILLER PIC X(01) VALUE 'A'.
05 FILLER PIC X(01) VALUE 'B'.
05 FILLER PIC X(01) VALUE 'C'.
05 FILLER PIC X(01) VALUE 'D'.
05 FILLER PIC X(01) VALUE 'E'.
05 FILLER PIC X(01) VALUE 'F'.
05 FILLER PIC X(01) VALUE 'G'.
05 FILLER PIC X(01) VALUE 'H'.
05 FILLER PIC X(01) VALUE 'I'.
05 FILLER PIC X(01) VALUE 'J'.
05 FILLER PIC X(01) VALUE 'K'.
05 FILLER PIC X(01) VALUE 'L'.
05 FILLER PIC X(01) VALUE 'M'.
05 FILLER PIC X(01) VALUE 'N'.
05 FILLER PIC X(01) VALUE 'O'.
05 FILLER PIC X(01) VALUE 'P'.
05 FILLER PIC X(01) VALUE 'Q'.
05 FILLER PIC X(01) VALUE 'R'.
05 FILLER PIC X(01) VALUE 'S'.
05 FILLER PIC X(01) VALUE 'T'.
05 FILLER PIC X(01) VALUE 'U'.
05 FILLER PIC X(01) VALUE 'V'.
05 FILLER PIC X(01) VALUE 'W'.
05 FILLER PIC X(01) VALUE 'X'.
05 FILLER PIC X(01) VALUE 'Y'.
05 FILLER PIC X(01) VALUE 'Z'.
05 FILLER PIC X(01) VALUE '['.
05 FILLER PIC X(01) VALUE '\'.
05 FILLER PIC X(01) VALUE ']'.
05 FILLER PIC X(01) VALUE '^'.
05 FILLER PIC X(01) VALUE '_'.
05 FILLER PIC X(01) VALUE '`'.
05 FILLER PIC X(01) VALUE 'a'.
05 FILLER PIC X(01) VALUE 'b'.
05 FILLER PIC X(01) VALUE 'c'.
05 FILLER PIC X(01) VALUE 'd'.
05 FILLER PIC X(01) VALUE 'e'.
05 FILLER PIC X(01) VALUE 'f'.
05 FILLER PIC X(01) VALUE 'g'.
05 FILLER PIC X(01) VALUE 'h'.
05 FILLER PIC X(01) VALUE 'i'.
05 FILLER PIC X(01) VALUE 'j'.
05 FILLER PIC X(01) VALUE 'k'.
05 FILLER PIC X(01) VALUE 'l'.
05 FILLER PIC X(01) VALUE 'm'.
05 FILLER PIC X(01) VALUE 'n'.
05 FILLER PIC X(01) VALUE 'o'.
05 FILLER PIC X(01) VALUE 'p'.
05 FILLER PIC X(01) VALUE 'q'.
05 FILLER PIC X(01) VALUE 'r'.
05 FILLER PIC X(01) VALUE 's'.
05 FILLER PIC X(01) VALUE 't'.
05 FILLER PIC X(01) VALUE 'u'.
05 FILLER PIC X(01) VALUE 'v'.
05 FILLER PIC X(01) VALUE 'w'.
05 FILLER PIC X(01) VALUE 'x'.
05 FILLER PIC X(01) VALUE 'y'.
05 FILLER PIC X(01) VALUE 'z'.
05 FILLER PIC X(01) VALUE '{'.
05 FILLER PIC X(01) VALUE '|'.
05 FILLER PIC X(01) VALUE '}'.
05 FILLER PIC X(01) VALUE '~'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
05 FILLER PIC X(01) VALUE '?'.
03 FILLER REDEFINES ASCIIS.
05 ASKI PIC X(01) OCCURS 256.
LINKAGE SECTION.
01 SQL-ID PIC X(06).
01 SQLCA.
03 SQLCAID PIC X(8) VALUE X"0000000000000000".
03 SQLCABC PIC S9(9) BINARY.
03 SQLCODE PIC S9(9) BINARY.
03 SQLERRM.
49 SQLERRML PIC S9(4) BINARY.
49 SQLERRMC PIC X(70).
03 SQLERRP PIC X(8).
03 SQLERRD OCCURS 6 TIMES
PIC S9(9) BINARY.
03 SQLWARN.
05 SQLWARN0 PIC X.
05 SQLWARN1 PIC X.
05 SQLWARN2 PIC X.
05 SQLWARN3 PIC X.
05 SQLWARN4 PIC X.
05 SQLWARN5 PIC X.
05 SQLWARN6 PIC X.
05 SQLWARN7 PIC X.
05 SQLWARN8 PIC X.
05 SQLWARN9 PIC X.
05 SQLWARN10 PIC X.
05 SQLWARNA
REDEFINES
SQLWARN10 PIC X.
03 SQLSTATE PIC X(5).
01 EYECATCHER.
03 IC PIC X(01) OCCURS 2.
PROCEDURE DIVISION USING SQL-ID, SQLCA, EYECATCHER.
SQUELCH5-SUBPROGRAM.
DISPLAY ' '.
DISPLAY '################ SQUELCH5 - SUBPROGRAM ####'
SQL-ID.
DISPLAY '################ SQUELCH5 + SUBPROGRAM -'
'ON ENTRY'
DISPLAY '################ SQUELCH5 + RETURN-CODE'
RETURN-CODE '####'.
DISPLAY '================================================='
*** DISPLAY ' '
IF SQL-ID = 'FINIS'
OPEN OUTPUT SQL-IN-FILE
MOVE 'CONNECT RESET~'
TO SQL-IN-RECORD
PERFORM WRITE-SQL-IN-RECORD
MOVE 'TERMINATE~'
TO SQL-IN-RECORD
PERFORM WRITE-SQL-IN-RECORD
MOVE 'QUIT~'
TO SQL-IN-RECORD
PERFORM WRITE-SQL-IN-RECORD
CLOSE SQL-IN-FILE
CALL 'WREAD1'
CALL 'STOP1'
GO GOB
END-IF.
PERFORM INITIALIZATION.
PERFORM PROCESS-DISPLAY-FILE.
PERFORM GET-SQL.
PERFORM PROCESS-INTO.
PERFORM SUBSTITUTE.
PERFORM OTHER-SQL.
DISPLAY '################ SQUELCH5-SUBPROGRAM' '#### ENDED'.
GOB.
GOBACK.
INITIALIZATION SECTION.
IF FIRST-TIME-THRU = 'Y'
MOVE 'N' TO FIRST-TIME-THRU
OPEN INPUT ERR-FILE
PERFORM PROCESS-ERR-FILE
CLOSE ERR-FILE
MOVE 'N' TO EOF-DATABASE
OPEN INPUT DATABASE-FILE
PERFORM READ-DATABASE-FILE
IF EOF-DATABASE = 'Y'
DISPLAY 'DB2PREPZ - DATABASE FILE EMPTY'
MOVE 16 TO RETURN-CODE
END-IF
IF DATABASE-RECORD = SPACES
DISPLAY 'DB2PREPZ - DATABASE FILE NAME EMPTY'
MOVE 16 TO RETURN-CODE
END-IF
CLOSE DATABASE-FILE
IF RETURN-CODE = 0
OPEN OUTPUT SQL-IN-FILE
MOVE SPACES TO SQL-IN-RECORD
MOVE 'CONNECT TO '
TO SQL-IN-RECORD(1:11)
MOVE DATABASE-RECORD(1:8)
TO SQL-IN-RECORD(12:8)
MOVE '~' TO SQL-IN-RECORD(20:1)
PERFORM WRITE-SQL-IN-RECORD
CLOSE SQL-IN-FILE
CALL 'START1'
CALL 'WREAD1'
ELSE
GO IW
END-IF
END-IF.
IW.
IX. EXIT.
PROCESS-DISPLAY-FILE SECTION.
OPEN INPUT DISPLAY-FILE.
MOVE 'N' TO DISPLAY-FILE-ENDED.
PERFORM READ-DISPLAY-FILE.
IF DISPLAY-FILE-ENDED = 'Y'
DISPLAY 'SQUELCH5 display-file empty'
MOVE 16 TO RETURN-CODE
PERFORM RC16
END-IF.
PERFORM VARYING DFUB1
FROM 1 BY 1
UNTIL DISPLAY-FILE-ENDED = 'Y'
OR DISPLAY-RECORD = SPACES
IF DISPLAY-RECORD-1-TO-5 NOT = 'empty'
MOVE DISPLAY-RECORD TO DISPLAY-ARRAY(DFUB1)
PERFORM READ-DISPLAY-FILE
ELSE
MOVE 'Y' TO DISPLAY-FILE-ENDED
END-IF
END-PERFORM.
IF DISPLAY-FILE-ENDED = 'Y'
OR DISPLAY-RECORD = SPACES
ADD -1 TO DFUB1
END-IF.
PDFC.
CLOSE DISPLAY-FILE.
PDFW.
PDFX. EXIT.
GET-SQL SECTION.
OPEN INPUT SQL-FILE.
MOVE 'N' TO SQL-FILE-ENDED.
PERFORM READ-SQL-FILE.
IF SQL-FILE-ENDED = 'Y'
DISPLAY 'SQUELCH5 sql-file empty'
MOVE 16 TO RETURN-CODE
PERFORM RC16
END-IF.
PERFORM VARYING DUM1 FROM 1 BY 1
UNTIL SQL-FILE-ENDED = 'Y'
IF SQL-RECORD-1-TO-6 = SQL-ID
PERFORM READ-SQL-FILE
PERFORM VARYING SQUB1
FROM 1 BY 1
UNTIL SQL-FILE-ENDED = 'Y'
OR (SQL-RECORD-1-TO-3 = 'SQL' AND
SQL-RECORD-7-TO-7 = '*')
MOVE SQL-RECORD
TO SQL-ARRAY(SQUB1)
PERFORM READ-SQL-FILE
END-PERFORM
IF SQL-FILE-ENDED NOT = 'Y'
ADD -1 TO SQUB1
END-IF
IF NOT (SQL-RECORD-1-TO-3 = 'SQL' AND
SQL-RECORD-7-TO-7 = '*')
ADD -1 TO SQUB1
END-IF
ELSE
PERFORM READ-SQL-FILE
END-IF
END-PERFORM.
IF SQUB1 = 0
DISPLAY 'SQUELCH5 sql-file - 0 records'
' for ' SQL-ID
MOVE 16 TO RETURN-CODE
PERFORM RC16
END-IF.
CLOSE SQL-FILE.
perform varying squb26 from 1 by 1 until squb26 > squb1 display 'get-sql' squb26 sql-array(squb26) *** end-perform.
GSX. EXIT.
PROCESS-INTO SECTION.
MOVE 0 TO INTUB1.
SO HERE WE ARE DEALING WITH THE HOST VARIABLES THAT APPEAR IN THE "INTO" CLAUSE IN THE SQL-ARRAY, WHERE THEY ARE CURRENTLY COMMENTED-OUT (-- IN 1ST AND 2ND BYTE AND A SPACE IN THE 3RD BYTE OF SQL-ARRAY-BYTES)
*** DISPLAY 'PI - 1 SQUB1' SQUB1.
PERFORM VARYING SQUB2
FROM 1 BY 1
UNTIL SQUB2 > SQUB1
MOVE SQL-ARRAY(SQUB2)(1:7)
TO SEVENCHAR
IF SEVENCHAR = '-- INTO'
ADD 1 SQUB2 GIVING SQUB3
PERFORM VARYING SQUB3
FROM SQUB3 BY 1
UNTIL SQUB3 > SQUB1
MOVE SQL-ARRAY(SQUB3)(1:4)
TO FOURCHAR
IF FOURCHAR = '-- ,'
OR FOURCHAR = '-- '
OR TWOCHAR NOT = '--'
MOVE DUMMY TO DUMMY
ELSE
MOVE 0 TO COLON-COUNT
PERFORM VARYING SQUC1
FROM 4 BY 1
UNTIL SQUC1 > 70
MOVE SQL-ARRAY(SQUB3)(SQUC1:1)
TO ONECHAR
A ":" MARKS THE START OF A HOST VARIABLE A SPACE OR ANOTHER : ARE THE DELIMITERS OF A HOST VARIABLE IF ONECHAR = ':' OR ONECHAR = SPACE IF ONECHAR = ':' ADD 1 TO COLON-COUNT MOVE SQUC1 TO COLON-AT (COLON-COUNT) ELSE IF COLON-COUNT NOT = 0 MOVE SQUC1 TO SPACE-AT (COLON-COUNT) ELSE DISPLAY 'SQUELCH5 -' 'PROCESS-INTO -' 'HOST VARIABLE ENDS' 'PREMATURELY @' 'COLUMN SQUC1=' SQUC1 'OF SQUB3' SQUB3 'SQL-ARRAY(SQUB3)' SQL-ARRAY(SQUB3) MOVE 16 TO RETURN-CODE PERFORM RC16 END-IF END-IF END-IF END-PERFORM ADD 1 TO INTUB1 IF COLON-COUNT = 1 COMPUTE BEEGIN = COLON-AT(1) + 1 COMPUTE PHOR1 = SPACE-AT(1) - BEEGIN
MOVE SPACES
TO INTO-ARRAY(INTUB1)
MOVE SQL-ARRAY(SQUB3)(BEEGIN:PHOR1)
TO INTO-ARRAY(INTUB1)
MOVE SPACES
TO INTO-IV-ARRAY(INTUB1)
ELSE
IF COLON-COUNT = 2
COMPUTE BEEGIN = COLON-AT(1) + 1
COMPUTE PHOR2 = COLON-AT(2) - BEEGIN
MOVE SPACES
TO INTO-ARRAY(INTUB1)
MOVE SQL-ARRAY(SQUB3)(BEEGIN:PHOR2)
TO INTO-ARRAY(INTUB1)
COMPUTE BEEGIN = COLON-AT(2) + 1
COMPUTE PHOR2 = SPACE-AT(1) - BEEGIN
MOVE SPACES
TO INTO-IV-ARRAY(INTUB1)
MOVE SQL-ARRAY(SQUB3)(BEEGIN:PHOR2)
TO INTO-IV-ARRAY(INTUB1)
ELSE
DISPLAY 'SQUELCH5 - PROCESS-INTO -'
'COLON COUNT'
'NOT 1 OR 2 ('
COLON-COUNT
') IN SQUB3' SQUB3
'SQL-ARRAY(SQUB3)'
SQL-ARRAY(SQUB3)
MOVE 16 TO RETURN-CODE
PERFORM RC16
END-IF
END-IF
END-IF
END-PERFORM
END-IF
END-PERFORM.
*** DISPLAY 'PI - 2 SQUB1' SQUB1.
PERFORM VARYING INTUB2
FROM 1 BY 1
UNTIL INTUB2 > INTUB1
PERFORM VARYING WSUB2
FROM 1 BY 1
UNTIL WSUB2 > 31
MOVE INTO-ARRAY-BYTE(INTUB2, WSUB2)
TO SECUND
IF SECUND NOT > 'z' AND
SECUND NOT < 'a'
COMPUTE TWOGETHER = TWOGETHER + 64
MOVE SECUND TO INTO-ARRAY-BYTE(INTUB2, WSUB2)
END-IF
MOVE INTO-IV-ARRAY-BYTE(INTUB2, WSUB2)
TO SECUND
IF SECUND NOT > 'z' AND
SECUND NOT < 'a'
COMPUTE TWOGETHER = TWOGETHER + 64
MOVE SECUND
TO INTO-IV-ARRAY-BYTE(INTUB2, WSUB2)
END-IF
END-PERFORM
END-PERFORM.
*** DISPLAY 'PI - 3 SQUB1' SQUB1.
PERFORM VARYING INTUB2
FROM 1 BY 1
UNTIL INTUB2 > INTUB1
TRANSLATE INTO-ARRAY(INTUB2), BEING THE FIELD NAME, INTO EBCDIC XLATE INTO-ARRAY(INTUB2) 31 E PERFORM VARYING WSUB2 FROM 1 BY 1 UNTIL WSUB2 > WSUB1 OR WS-DATA(WSUB2) = INTO-ARRAY(INTUB2) END-PERFORM IF WS-DATA(WSUB2) = INTO-ARRAY(INTUB2) MOVE WSUB2 TO INTO-ARRAY-PTR(INTUB2) ELSE DISPLAY 'SQUELCH5 - PROCESS-INTO -' 'INTUB2' INTUB2 'INTO-ARRAY(INTUB2)' INTO-ARRAY(INTUB2) 'UNMATCHED' MOVE 16 TO RETURN-CODE PERFORM RC16 END-IF MOVE 0 TO INTO-IV-ARRAY-PTR(INTUB2) IF INTO-IV-ARRAY(INTUB2) NOT = SPACES TRANSLATE THE INDICATOR-VARIABLE NAME TO EBCDIC, TOO XLATE INTO-IV-ARRAY(INTUB2) 31 E PERFORM VARYING WSUB2 FROM 1 BY 1 UNTIL WSUB2 > WSUB1 OR WS-DATA(WSUB2) = INTO-IV-ARRAY(INTUB2) END-PERFORM IF WS-DATA(WSUB2) = INTO-IV-ARRAY(INTUB2) MOVE WSUB2 TO INTO-IV-ARRAY-PTR(INTUB2) ELSE DISPLAY 'SQUELCH5 - PROCESS-INTO -' 'INTUB2' INTUB2 'INTO-IV-ARRAY(INTUB2)' INTO-IV-ARRAY(INTUB2) 'UNMATCHED' MOVE 16 TO RETURN-CODE PERFORM RC16 END-IF END-IF END-PERFORM.
*** DISPLAY 'PI - 4 SQUB1' SQUB1.
PIW.
perform varying squb26 from 1 by 1 until squb26 > squb1 display 'process-into' squb26 sql-array(squb26) *** end-perform. PIX. EXIT.
SUBSTITUTE SECTION.
MOVE 1 TO DFUB2.
MOVE 1 TO SQUB2.
THE SQL-FILE ALREADY HAS THE "INTO" CLAUSE FIELDS COMMENTED OUT
SO HERE WE ARE JUST DEALING WITH THE REMAINING HOST VARIABLES
PERFORM UNTIL (DFUB2 > DFUB1)
OR (SQUB2 > SQUB1)
OR RETURN-CODE NOT = 0
IF SQL-ARRAY-1-TO-1(SQUB2) = ':'
PERFORM VARYING WSUB2
FROM 1 BY 1
UNTIL WSUB2 > 31
MOVE SQL-ARRAY-2-TO-32(SQUB2)
(WSUB2:1)
TO SECUND
IF SECUND NOT > 'z' AND
SECUND NOT < 'a'
COMPUTE TWOGETHER = TWOGETHER + 64
MOVE SECUND TO SQL-ARRAY-2-TO-32(SQUB2)
(WSUB2:1)
END-IF
END-PERFORM
PERFORM VARYING WSUB2
FROM 1 BY 1
UNTIL WSUB2 > WSUB1
XLATE WS-DATA(WSUB2) 31 E
END-PERFORM
PERFORM VARYING WSUB2
FROM 1 BY 1
UNTIL WSUB2 > WSUB1
OR WS-DATA(WSUB2) = SQL-ARRAY-2-TO-32(SQUB2)
END-PERFORM
IF WS-DATA(WSUB2) = SQL-ARRAY-2-TO-32(SQUB2)
IF WS-PIC-TYP(WSUB2) = 'X'
*** THE HOST VARIABLE IS A PIC X FIELD, SO NEEDS QUOTES
MOVE WS-LEN9(WSUB2) TO LENTH
MOVE KWOTE TO SQL-ARRAY-1-TO-1(SQUB2)
MOVE DISPLAY-ARRAY(DFUB2)(1:LENTH)
TO SQL-ARRAY-2-TO-32(SQUB2)(1:LENTH)
COMPUTE LENTH-PLUS-1 = LENTH + 1
MOVE KWOTE TO SQL-ARRAY-2-TO-32(SQUB2)
(LENTH-PLUS-1:1)
ELSE
MOVE display-array(DFUB2)
TO SQL-ARRAY(SQUB2)
END-IF
ADD 1 TO DFUB2
ADD 1 TO SQUB2
ELSE
DISPLAY 'SQUELCH5 - SUBSTITUTE -'
'SQUB2'
SQUB2
'SQL-ARRAY-2-TO-32(SQUB2)'
SQL-ARRAY-2-TO-32(SQUB2)
'not found in WSS;'
MOVE 16 TO RETURN-CODE
PERFORM RC16
END-IF
ELSE
ADD 1 TO SQUB2
END-IF
END-PERFORM.
ADD -1 TO SQUB2.
SW.
perform varying squb26 from 1 by 1 until squb26 > squb1 display 'substitute' squb26 sql-array(squb26) *** end-perform.
SX. EXIT.
OTHER-SQL SECTION.
*** DISPLAY 'OTHER-SQL'. OPEN OUTPUT SQL-IN-FILE.
PERFORM VARYING SQUB2
FROM 1 BY 1
UNTIL SQUB2 > SQUB1
MOVE SQL-ARRAY(SQUB2)
TO SQL-IN-RECORD
PERFORM WRITE-SQL-IN-RECORD
END-PERFORM.
MOVE '~' TO SQL-IN-RECORD.
PERFORM WRITE-SQL-IN-RECORD.
CLOSE SQL-IN-FILE.
CALL 'WREAD1'.
OPEN INPUT SQL-RESULT-FILE.
MOVE 'N' TO SQL-RESULT-FILE-ENDED.
PERFORM GET-SQLCODE.
CLOSE SQL-RESULT-FILE.
PERFORM PUT-SELECTED-IN-HV.
IF RETURN-CODE = 16
PERFORM RC16
END-IF.
perform varying squb26 from 1 by 1 until squb26 > squb1 display 'other-sql' squb26 sql-array(squb26) *** end-perform.
OSX. EXIT.
PUT-SELECTED-IN-HV SECTION.
MOVE 0 TO INTUB2.
OPEN INPUT SQL-RESULT-FILE.
MOVE 'N' TO SQL-RESULT-FILE-ENDED.
PERFORM READ-SQL-RESULT-FILE.
PERFORM READ-SQL-RESULT-FILE.
PERFORM UNTIL SQL-RESULT-FILE-ENDED = 'Y'
ADD 1 TO INTUB2 MOVE SQL-RESULT-RECORD(3:2) TO TWOCHAR IF FORCHAR = '- ' MOVE INTO-IV-ARRAY-PTR(INTUB2) TO WSUB2 SUBTRACT ADDRESS-OF-EYECATCHER9 FROM WS-ADDR9(WSUB2) GIVING TOO *** ADD 1 TO TOO
MOVE MINUS1-1 TO IC(TOO) ADD 1 TOO GIVING TOOP MOVE MINUS1-2 TO IC(TOOP) ELSE MOVE INTO-ARRAY-PTR(INTUB2) TO WSUB2 SUBTRACT ADDRESS-OF-EYECATCHER9 FROM WS-ADDR9(WSUB2) GIVING TOO ADD 1 TO TOO *** END-IF PERFORM READ-SQL-RESULT-FILE. END-PERFORM. CLOSE SQL-RESULT-FILE.
PSIHX. EXIT.
HEX-TO-CHAR SECTION.
IF HEX-PAIR1 = '0'
MOVE 0 TO TWOGETHER
ELSE
IF HEX-PAIR1 = '1'
MOVE 16 TO TWOGETHER
ELSE
IF HEX-PAIR1 = '2'
MOVE 32 TO TWOGETHER
ELSE
IF HEX-PAIR1 = '3'
MOVE 48 TO TWOGETHER
ELSE
IF HEX-PAIR1 = '4'
MOVE 64 TO TWOGETHER
ELSE
IF HEX-PAIR1 = '5'
MOVE 80 TO TWOGETHER
ELSE
IF HEX-PAIR1 = '6'
MOVE 96 TO TWOGETHER
ELSE
IF HEX-PAIR1 = '7'
MOVE 112 TO TWOGETHER
ELSE
IF HEX-PAIR1 = '8'
MOVE 128 TO TWOGETHER
ELSE
IF HEX-PAIR1 = '9'
MOVE 144 TO TWOGETHER
ELSE
IF HEX-PAIR1 = 'A'
MOVE 160 TO TWOGETHER
ELSE
IF HEX-PAIR1 = 'B'
MOVE 176 TO TWOGETHER
ELSE
IF HEX-PAIR1 = 'C'
MOVE 192 TO TWOGETHER
ELSE
IF HEX-PAIR1 = 'D'
MOVE 208 TO TWOGETHER
ELSE
IF HEX-PAIR1 = 'E'
MOVE 224 TO TWOGETHER
ELSE
IF HEX-PAIR1 = 'F'
MOVE 240 TO TWOGETHER
END-IF.
IF HEX-PAIR2 = '0'
MOVE DUMMY TO DUMMY
ELSE
IF HEX-PAIR2 = '1'
ADD 1 TO TWOGETHER
ELSE
IF HEX-PAIR2 = '2'
ADD 2 TO TWOGETHER
ELSE
IF HEX-PAIR2 = '3'
ADD 3 TO TWOGETHER
ELSE
IF HEX-PAIR2 = '4'
ADD 4 TO TWOGETHER
ELSE
IF HEX-PAIR2 = '5'
ADD 5 TO TWOGETHER
ELSE
IF HEX-PAIR2 = '6'
ADD 6 TO TWOGETHER
ELSE
IF HEX-PAIR2 = '7'
ADD 7 TO TWOGETHER
ELSE
IF HEX-PAIR2 = '8'
ADD 8 TO TWOGETHER
ELSE
IF HEX-PAIR2 = '9'
ADD 9 TO TWOGETHER
ELSE
IF HEX-PAIR2 = 'A'
ADD 10 TO TWOGETHER
ELSE
IF HEX-PAIR2 = 'B'
ADD 11 TO TWOGETHER
ELSE
IF HEX-PAIR2 = 'C'
ADD 12 TO TWOGETHER
ELSE
IF HEX-PAIR2 = 'D'
ADD 13 TO TWOGETHER
ELSE
IF HEX-PAIR2 = 'E'
ADD 14 TO TWOGETHER
ELSE
IF HEX-PAIR2 = 'F'
ADD 15 TO TWOGETHER
END-IF.
*** SECUND HOLDS THE DECIMAL VALUE OF THE HEX PAIR IN A SINGLE BYTE
HTCX. EXIT.
GET-SQLCODE SECTION.
MOVE 'N' TO SQL-RESULT-FILE-ENDED.
PERFORM VARYING KOUNT FROM 1 BY 1
UNTIL SQL-RESULT-FILE-ENDED = 'Y'
move 'N' to MATCH-FOUND
perform read-SQL-RESULT-file
if sql-RESULT-file-ended = 'N'
move sql-RESULT-record (1:17)
to seventeenchar
if seventeenchar = ' sqlcaid : SQLCA '
move 'Y' to MATCH-FOUND
end-if
end-if
IF MATCH-FOUND = 'Y'
move 'N' to MATCH-FOUND
perform varying SQRUB1 from 1 by 1
until SQRUB1 > 60
or MATCH-FOUND = 'Y'
move sql-RESULT-record (SQRUB1:9)
to ninechar
if ninechar = 'sqlcode: '
move 'Y' to MATCH-FOUND
compute SQRUB2 = SQRUB1 + 9
end-if
end-perform
END-IF
IF MATCH-FOUND = 'Y'
move 'N' to MATCH-FOUND
perform varying SQRUB3 from SQRUB2 by 1
until SQRUB3 > 60
or MATCH-FOUND = 'Y'
move sql-RESULT-record (SQRUB3:9)
to ninechar
if ninechar = ' sqlerr'
move 'Y' to MATCH-FOUND
compute SQRUB3 = SQRUB3 - SQRUB2
move sql-result-record(SQRUB2:SQRUB3)
to LUMP
if LUMP(1:1) = '-'
move '-' to syne
compute SQRUB3 = SQRUB3 - 1
move zeroes to NINE04-ZEROES
compute SQRUB4 = 5 - SQRUB3
move LUMP(2:SQRUB3)
to NINE04-ZEROES
(SQRUB4:SQRUB3)
else
move '+' to syne
move zeroes to NINE04-ZEROES
compute SQRUB4 = 5 - SQRUB3
move LUMP(1:SQRUB3)
to NINE04-ZEROES
(SQRUB4:SQRUB3)
end-if
if syne = '+'
compute SQLCODE = NINE04-ZEROES
else
compute SQLCODE = 0 -
NINE04-ZEROES
end-if
display 'SQUELCH5 sqlcode=' SQLCODE
';'
end-if
end-perform
END-IF
end-PERFORM.
GSCX. EXIT.
PROCESS-ERR-FILE SECTION.
PERFORM READ-ERR-FILE.
IF ERR-FILE-ENDED = 'Y'
DISPLAY '########################'
DISPLAY 'SQUELCH5 ERR-FILE EMPTY'
DISPLAY '########################'
MOVE 16 TO RETURN-CODE
PERFORM RC16
END-IF.
MOVE 0 TO WSUB1.
PERFORM VARYING KOUNT FROM 1 BY 1
UNTIL ERR-FILE-ENDED = 'Y'
PERFORM READ-ERR-FILE
IF ERR-FILE-ENDED = 'N'
MOVE ERR-RECORD (33:9)
TO NINECHAR
IF NINECHAR = 'workstor '
MOVE 0 TO STUB1
PERFORM VARYING PRUB1 FROM 41 BY 1
UNTIL PRUB1 > 255
MOVE ERR-RECORD(PRUB1:1)
TO ONECHAR
MOVE 0 TO PRUB3
IF ONECHAR NOT = SPACE
MOVE 'N' TO SPACE-FOUND
PERFORM VARYING PRUB2 FROM PRUB1 BY 1
UNTIL SPACE-FOUND = 'Y'
MOVE ERR-RECORD(PRUB2:1)
TO ONECHAR
IF ONECHAR = SPACE
MOVE 'Y' TO SPACE-FOUND
ELSE
ADD 1 TO PRUB3
END-IF
END-PERFORM
END-IF
IF PRUB3 > 0
ADD 1 TO STUB1
MOVE ERR-RECORD(PRUB1:PRUB3)
TO STORE(STUB1)
ADD PRUB3 TO PRUB1
ADD -1 TO PRUB1
END-IF
END-PERFORM
ADD 1 TO WSUB1
IF WSUB1 > 200
DISPLAY '###################'
DISPLAY 'SQUELCH5 WS- > 200'
DISPLAY '###################'
MOVE 16 TO RETURN-CODE
PERFORM RC16
END-IF
MOVE STORE(1) TO WS-DATA(WSUB1)
PERFORM VARYING WSUB2
FROM 1 BY 1
UNTIL WSUB2 > 31
MOVE WS-DATA(WSUB1)(WSUB2:1)
TO ONECHAR
IF ONECHAR = '_'
MOVE '-'
TO WS-DATA(WSUB1)
(WSUB2:1)
END-IF
END-PERFORM
MOVE STORE(2) TO WS-LVL(WSUB1)
MOVE STORE(3) TO WS-ADDR(WSUB1)
MOVE 'N' TO DIGIT-FOUND
PERFORM VARYING ADUB1 FROM 8 BY -1
UNTIL ADUB1 = 0
OR DIGIT-FOUND = 'Y'
MOVE WS-ADDR(WSUB1)(ADUB1:1)
TO ONECHAR
IF ONECHAR NOT < '0'
IF ONECHAR NOT > '9'
MOVE 'Y' TO DIGIT-FOUND
END-IF
END-IF
END-PERFORM
IF DIGIT-FOUND = 'N'
DISPLAY '###############################'
DISPLAY 'SQUELCH5 ADDR STUFFED='
WS-ADDR(WSUB1)
DISPLAY '###############################'
MOVE 16 TO RETURN-CODE
PERFORM RC16
ELSE
ADD 1 TO ADUB1
IF ADUB1 < 8
COMPUTE ADUB2 = 9 - ADUB1
COMPUTE ADUB3 = 9 - ADUB2
MOVE WS-ADDR(WSUB1)
TO SAVE-ADDR
MOVE '00000000'
TO WS-ADDR(WSUB1)
MOVE SAVE-ADDR(1:ADUB3)
TO WS-ADDR(WSUB1)(ADUB2:ADUB3)
END-IF
MOVE STORE(1)(1:10)
TO TENCHAR
IF TENCHAR = 'EYECATCHER'
MOVE WS-ADDR(WSUB1)
TO ADDRESS-OF-EYECATCHER
DISPLAY'PEF - ADDRESS-OF-EYECATCHER9'
ADDRESS-OF-EYECATCHER9
END-IF
END-IF
MOVE STORE(4) TO WS-LEN(WSUB1)
MOVE 'N' TO DIGIT-FOUND
PERFORM VARYING ADUB1 FROM 8 BY -1
UNTIL ADUB1 = 0
OR DIGIT-FOUND = 'Y'
MOVE WS-LEN(WSUB1)(ADUB1:1)
TO ONECHAR
IF ONECHAR NOT < '0'
IF ONECHAR NOT > '9'
MOVE 'Y' TO DIGIT-FOUND
END-IF
END-IF
END-PERFORM
IF DIGIT-FOUND = 'N'
DISPLAY '###############################'
DISPLAY 'SQUELCH5 LEN STUFFED='
WS-LEN(WSUB1)
DISPLAY '###############################'
MOVE 16 TO RETURN-CODE
PERFORM RC16
ELSE
ADD 1 TO ADUB1
IF ADUB1 < 8
COMPUTE ADUB2 = 9 - ADUB1
COMPUTE ADUB3 = 9 - ADUB2
MOVE WS-LEN(WSUB1)
TO SAVE-LEN
MOVE '00000000'
TO WS-LEN(WSUB1)
MOVE SAVE-LEN(1:ADUB3)
TO WS-LEN(WSUB1)(ADUB2:ADUB3)
END-IF
END-IF
MOVE STORE(5) TO WS-PIC(WSUB1)
MOVE STORE(6) TO WS-PIC-TYP(WSUB1)
MOVE STORE(7) TO WS-PIC-SIGN(WSUB1)
MOVE STORE(8) TO WS-PIC-DEC(WSUB1)
END-IF
END-IF
END-PERFORM.
PEFX. EXIT.
READ-ERR-FILE SECTION.
READ ERR-FILE
AT END
MOVE 'Y' TO ERR-FILE-ENDED
GO REFX
END-READ.
REFX. EXIT.
READ-SQL-FILE SECTION.
READ SQL-FILE
AT END
MOVE 'Y' TO SQL-FILE-ENDED
GO RSFX
END-READ.
RSFX. EXIT.
READ-DISPLAY-FILE SECTION.
READ DISPLAY-FILE
AT END
MOVE 'Y' TO DISPLAY-FILE-ENDED
GO RDFX
END-READ.
RDFX. EXIT.
READ-SQL-RESULT-FILE SECTION.
READ SQL-RESULT-FILE
AT END
MOVE 'Y' TO SQL-RESULT-FILE-ENDED
GO RSRFX
END-READ.
*** DISPLAY 'RSRF' SRR120. RSRFX. EXIT.
READ-DATABASE-FILE SECTION.
READ DATABASE-FILE
AT END
MOVE 'Y' TO EOF-DATABASE
GO RDFX
END-READ.
RDFX. EXIT.
WRITE-SQL-IN-RECORD SECTION.
WRITE SQL-IN-RECORD.
DISPLAY '>>>>' SQL-IN-RECORD1 '<<<<'. DISPLAY '>>>>' SQL-IN-RECORD2 '<<<<'. MOVE SPACES TO SQL-IN-RECORD. WSIRX. EXIT.
RC16 SECTION.
DISPLAY '>>>>'.
DISPLAY '>>>> STOPPING WITH FATAL ERROR <<<<'.
DISPLAY '>>>>'.
STOP RUN.
RC16X. EXIT.
IDENTIFICATION DIVISION.
PROGRAM-ID. FORTY9.
*** =========================================================================
FORTY9 is used by DB2CRE8 to get the picture for a possible varchar field. __
A VARCHAR field in ZCOBOL has a 2 byte length field, S9(04) COMP of PIC level 49, followed by another PIC level 49 field *** which houses the characters themselves.
The receiving field might be longer than the actual contents of the VARCHAR field.
We have to be careful here because if we look for the name of the field in ws-data(wsub2), the length of this field will be 0, since it's the group field in which the level 49 fields live. So if we want the actual length of the ZCOBOL field, we have to look in ws-len9(wsub2 + 2). And then add 2 for the length of the length field.
*** VARCHAR fields have a maximum length of 32,672 bytes.
*** ===========================================================================
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT ERR-FILE
ASSIGN TO ERRFILE
ORGANIZATION IS LINE SEQUENTIAL.
DATA DIVISION.
FILE SECTION.
FD ERR-FILE
DATA RECORD IS ERR-RECORD.
01 ERR-RECORD PIC X(255).
WORKING-STORAGE SECTION.
01 THE-NAME PIC X(31).
01 WSSS.
03 WSS OCCURS 200.
05 WS-DATA PIC X(31).
05 WS-LVL PIC X(02).
05 WS-ADDR.
07 WS-ADDR9 PIC 9(08).
05 WS-LEN.
07 WS-LEN9 PIC 9(08).
05 WS-PIC PIC X(32).
05 WS-PIC-TYP PIC X(01).
05 WS-PIC-SIGN PIC X(01).
05 WS-PIC-DEC PIC X(02).
01 WSUB1 PIC S9(04) COMP.
01 WSUB2 PIC S9(04) COMP.
01 WSUB3 PIC S9(04) COMP.
01 WSUB4 PIC S9(04) COMP.
01 WSUB5 PIC 9(05).
01 FIRST-TIME-THRU PIC X(01) VALUE 'Y'.
01 VARCH-LEN PIC 9(05) VALUE 0.
01 ERR-FILE-ENDED PIC X(01) VALUE 'N'.
01 DIGIT-FOUND PIC X(01).
01 SAVE-ADDR PIC X(08).
01 SAVE-LEN PIC X(08).
01 ADUB1 PIC S9(04).
01 ADUB2 PIC S9(04).
01 ADUB3 PIC S9(04).
01 SPACE-FOUND PIC X(01).
01 kount pic 9(04).
01 PRUB1 PIC S9(04).
01 PRUB2 PIC 9(04).
01 PRUB3 PIC 9(04).
01 PRUB4 PIC 9(04).
01 TWOGETHER PIC 9(04) COMP.
01 FILLER REDEFINES TWOGETHER.
03 FILLER PIC X(01) VALUE LOW-VALUE.
03 SECUND PIC X(01).
01 STORESS.
03 STORES OCCURS 8.
05 STORE PIC X(32).
01 STUB1 PIC 9(04).
01 WS-CHARS.
03 SEVENTEENCHAR PIC X(17).
03 FILLER REDEFINES SEVENTEENCHAR.
05 FOURTEENCHAR PIC X(14).
05 FILLER PIC X(03).
03 FILLER REDEFINES SEVENTEENCHAR.
05 THIRTEENCHAR PIC X(13).
05 FILLER PIC X(04).
03 FILLER REDEFINES SEVENTEENCHAR.
05 TWELVECHAR PIC X(12).
05 FILLER PIC X(05).
03 FILLER REDEFINES SEVENTEENCHAR.
05 ELEVENCHAR PIC X(11).
05 FILLER PIC X(06).
03 FILLER REDEFINES SEVENTEENCHAR.
05 TENCHAR PIC X(10).
05 FILLER PIC X(07).
03 FILLER REDEFINES SEVENTEENCHAR.
05 NINECHAR PIC X(09).
05 FILLER PIC X(08).
03 FILLER REDEFINES SEVENTEENCHAR.
05 EIGHTCHAR PIC X(08).
05 FILLER PIC X(09).
03 FILLER REDEFINES SEVENTEENCHAR.
05 SEVENCHAR PIC X(07).
05 FILLER PIC X(10).
03 FILLER REDEFINES SEVENTEENCHAR.
05 SIXCHAR PIC X(06).
05 FILLER PIC X(11).
03 FILLER REDEFINES SEVENTEENCHAR.
05 FIVECHAR PIC X(05).
05 FILLER PIC X(12).
03 FILLER REDEFINES SEVENTEENCHAR.
05 FOURCHAR PIC X(04).
05 FILLER PIC X(13).
03 FILLER REDEFINES SEVENTEENCHAR.
05 THREECHAR PIC X(03).
05 FILLER PIC X(14).
03 FILLER REDEFINES SEVENTEENCHAR.
05 TWOCHAR PIC X(02).
05 FILLER PIC X(15).
03 FILLER REDEFINES SEVENTEENCHAR.
05 ONECHAR PIC X(01).
05 FILLER PIC X(16).
LINKAGE SECTION.
01 THE-NAME-IN PIC X(31).
01 THE-PICTURE PIC X(80).
01 FOWND PIC X(01).
PROCEDURE DIVISION USING THE-NAME-IN, THE-PICTURE, FOWND.
FORTY9-SUBPROGRAM.
MOVE THE-NAME-IN TO THE-NAME.
PERFORM INITIALIZATION.
PERFORM PROCESS-VARCHAR.
GOB.
GOBACK.
INITIALIZATION SECTION.
MOVE 'Q' TO FOWND.
IF FIRST-TIME-THRU = 'Y'
MOVE 'N' TO FIRST-TIME-THRU
OPEN INPUT ERR-FILE
PERFORM PROCESS-ERR-FILE
CLOSE ERR-FILE
END-IF.
IX. EXIT.
PROCESS-VARCHAR SECTION.
IF FOWND = 'X'
GO PVX
END-IF.
PERFORM VARYING WSUB2
FROM 1 BY 1
UNTIL WSUB2 > 31
MOVE THE-NAME(WSUB2:1)
TO SECUND
IF SECUND NOT > 'z' AND
SECUND NOT < 'a'
COMPUTE TWOGETHER = TWOGETHER + 64
MOVE SECUND TO THE-NAME(WSUB2:1)
END-IF
END-PERFORM.
PERFORM VARYING WSUB2
FROM 1 BY 1
UNTIL WSUB2 > WSUB1
OR WS-DATA(WSUB2) = THE-NAME
END-PERFORM.
IF WS-DATA(WSUB2) = THE-NAME
MOVE 'M' TO FOWND
ELSE
MOVE 'N' TO FOWND
GO PVX
END-IF.
IF WS-LEN9(WSUB2) = 0
COMPUTE WSUB3 = WSUB2 + 1
COMPUTE WSUB4 = WSUB2 + 2
IF WS-LVL(WSUB3) = '49' AND
WS-LVL(WSUB4) = '49'
COMPUTE WSUB5 = WS-LEN9(WSUB4) + 2
MOVE 'M' TO FOWND
ELSE
MOVE 'N' TO FOWND
GO PVX
END-IF
ELSE
MOVE 'N' TO FOWND
GO PVX
END-IF.
MOVE SPACES TO THE-PICTURE.
MOVE '01' TO THE-PICTURE(8:2).
MOVE THE-NAME-IN TO THE-PICTURE(11:31).
MOVE 'PIC X(' TO THE-PICTURE(43:6).
MOVE WSUB5 TO THE-PICTURE(49:5).
MOVE ').' TO THE-PICTURE(54:2).
MOVE 'Y' TO FOWND
PVX. EXIT.
PROCESS-ERR-FILE SECTION.
PERFORM READ-ERR-FILE.
IF ERR-FILE-ENDED = 'Y'
DISPLAY '#####################'
DISPLAY 'FORTY9 ERR-FILE EMPTY'
DISPLAY '#####################'
MOVE 'X' TO FOWND
GO PEFX
END-IF.
MOVE 0 TO WSUB1.
PERFORM VARYING KOUNT FROM 1 BY 1
UNTIL ERR-FILE-ENDED = 'Y'
PERFORM READ-ERR-FILE
IF ERR-FILE-ENDED = 'N'
MOVE ERR-RECORD (33:9)
TO NINECHAR
IF NINECHAR = 'workstor '
MOVE 0 TO STUB1
PERFORM VARYING PRUB1 FROM 41 BY 1
UNTIL PRUB1 > 255
MOVE ERR-RECORD(PRUB1:1)
TO ONECHAR
MOVE 0 TO PRUB3
IF ONECHAR NOT = SPACE
MOVE 'N' TO SPACE-FOUND
PERFORM VARYING PRUB2 FROM PRUB1 BY 1
UNTIL SPACE-FOUND = 'Y'
MOVE ERR-RECORD(PRUB2:1)
TO ONECHAR
IF ONECHAR = SPACE
MOVE 'Y' TO SPACE-FOUND
ELSE
ADD 1 TO PRUB3
END-IF
END-PERFORM
END-IF
IF PRUB3 > 0
ADD 1 TO STUB1
MOVE ERR-RECORD(PRUB1:PRUB3)
TO STORE(STUB1)
ADD PRUB3 TO PRUB1
ADD -1 TO PRUB1
END-IF
END-PERFORM
ADD 1 TO WSUB1
IF WSUB1 > 200
DISPLAY '################'
DISPLAY 'FORTY9 WS- > 200'
DISPLAY '################'
MOVE 'X' TO FOWND
GO PEFX
END-IF
MOVE STORE(1) TO WS-DATA(WSUB1)
PERFORM VARYING WSUB2
FROM 1 BY 1
UNTIL WSUB2 > 31
MOVE WS-DATA(WSUB1)(WSUB2:1)
TO ONECHAR
IF ONECHAR = '_'
MOVE '-'
TO WS-DATA(WSUB1)
(WSUB2:1)
END-IF
END-PERFORM
MOVE STORE(2) TO WS-LVL(WSUB1)
MOVE STORE(3) TO WS-ADDR(WSUB1)
MOVE 'N' TO DIGIT-FOUND
PERFORM VARYING ADUB1 FROM 8 BY -1
UNTIL ADUB1 = 0
OR DIGIT-FOUND = 'Y'
MOVE WS-ADDR(WSUB1)(ADUB1:1)
TO ONECHAR
IF ONECHAR NOT < '0'
IF ONECHAR NOT > '9'
MOVE 'Y' TO DIGIT-FOUND
END-IF
END-IF
END-PERFORM
IF DIGIT-FOUND = 'N'
DISPLAY '##########################'
DISPLAY 'FORTY9 ADDR STUFFED='
WS-ADDR(WSUB1)
DISPLAY '##########################'
MOVE 'X' TO FOWND
GO PEFX
ELSE
ADD 1 TO ADUB1
IF ADUB1 < 8
COMPUTE ADUB2 = 9 - ADUB1
COMPUTE ADUB3 = 9 - ADUB2
MOVE WS-ADDR(WSUB1)
TO SAVE-ADDR
MOVE '00000000'
TO WS-ADDR(WSUB1)
MOVE SAVE-ADDR(1:ADUB3)
TO WS-ADDR(WSUB1)(ADUB2:ADUB3)
END-IF
END-IF
MOVE STORE(4) TO WS-LEN(WSUB1)
MOVE 'N' TO DIGIT-FOUND
PERFORM VARYING ADUB1 FROM 8 BY -1
UNTIL ADUB1 = 0
OR DIGIT-FOUND = 'Y'
MOVE WS-LEN(WSUB1)(ADUB1:1)
TO ONECHAR
IF ONECHAR NOT < '0'
IF ONECHAR NOT > '9'
MOVE 'Y' TO DIGIT-FOUND
END-IF
END-IF
END-PERFORM
IF DIGIT-FOUND = 'N'
DISPLAY '#########################'
DISPLAY 'FORTY9 LEN STUFFED='
WS-LEN(WSUB1)
DISPLAY '#########################'
MOVE 'X' TO FOWND
GO PEFX
ELSE
ADD 1 TO ADUB1
IF ADUB1 < 8
COMPUTE ADUB2 = 9 - ADUB1
COMPUTE ADUB3 = 9 - ADUB2
MOVE WS-LEN(WSUB1)
TO SAVE-LEN
MOVE '00000000'
TO WS-LEN(WSUB1)
MOVE SAVE-LEN(1:ADUB3)
TO WS-LEN(WSUB1)(ADUB2:ADUB3)
END-IF
END-IF
MOVE STORE(5) TO WS-PIC(WSUB1)
MOVE STORE(6) TO WS-PIC-TYP(WSUB1)
MOVE STORE(7) TO WS-PIC-SIGN(WSUB1)
MOVE STORE(8) TO WS-PIC-DEC(WSUB1)
END-IF
END-IF
END-PERFORM.
PEFX. EXIT.
READ-ERR-FILE SECTION.
READ ERR-FILE
AT END
MOVE 'Y' TO ERR-FILE-ENDED
GO REFX
END-READ.
REFX. EXIT.
IDENTIFICATION DIVISION.
//01///PROGRAM-ID.
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT THE-FILE
ASSIGN TO 'SQL.CPY'
ORGANIZATION IS LINE SEQUENTIAL.
DATA DIVISION.
FILE SECTION.
FD THE-FILE
DATA RECORD IS THE-RECORD.
01 THE-RECORD.
03 the-record-1-to-65.
05 TR1 PIC X(01).
05 filler pic x(64).
03 FILLER PIC X(64935).
WORKING-STORAGE SECTION.
//05/// 01 SPACE-NOT-FOUND PIC X(01). 01 ANO-COUNT PIC 9(02) VALUE 0. 01 SIGNED-LONG-DECIMAL PIC 9(14)V9(17). 01 LONG-DECIMAL PIC 9(14)V9(17). 01 LONG-NUMERIC PIC 9(20). 01 SIGNED-LONG-NUMERIC PIC S9(20). 01 B4 PIC 9(02). 01 AFTA PIC 9(02). 01 B4-START PIC S9(02). 01 AFTA-START PIC S9(02). 01 LONG-DECIMAL-START PIC S9(02). 01 LONG-DP-START PIC S9(02).
01 SUB PIC S9(05).
01 THE-BACK PIC S9(05).
01 CUB1 PIC S9(05).
01 CUB2 PIC S9(05).
01 CUB3 PIC S9(05).
01 CUB4 PIC S9(05).
01 CUB5 PIC S9(05).
01 CUB6 PIC S9(05).
01 CUB7 PIC S9(05).
01 EOF PIC X(01).
01 THE-ARRAYSS.
03 THE-ARRAYS OCCURS 30.
05 TA-FROM PIC S9(05).
05 TA-TO PIC S9(05).
05 TA-LEN PIC S9(05).
05 TA-WTO PIC S9(05).
05 TA-WLEN PIC S9(05).
01 TAB1 PIC S9(02) VALUE 0.
01 TAB2 PIC S9(02).
01 TAB3 PIC S9(02).
01 A-FROM PIC S9(05).
01 A-TO PIC S9(05).
01 A-LEN PIC S9(05).
01 A-WTO PIC S9(05).
01 A-WLEN PIC S9(05).
01 A-OFFSET PIC S9(05).
01 DECIMAL PIC X(01).
01 MINERS PIC X(01).
01 ONECHAR PIC X(01).
01 TWOCHAR PIC X(02).
01 ELEVENCHAR PIC X(11).
01 TWENTYCHAR PIC X(20).
01 TWENTY6CHAR PIC X(26).
01 TENCHAR PIC X(10).
01 EIGHTCHAR PIC X(08).
01 THIRTY1CHAR PIC X(31).
01 LISTSS.
03 LISTS OCCURS 256.
05 LIST PIC X(01).
01 ACTULE.
03 ACTULE-1-TO-31 PIC X(31).
03 FILLER PIC X(225).
01 HUB2 PIC 9(04).
01 THE-BACK-FOUND PIC X(01) VALUE 'N'.
01 KOUNT PIC 9(02).
01 KOUNT2 PIC 9(02).
01 KOUNT3 PIC 9(02).
01 KOUNT4 PIC 9(02).
01 KOUNT5 PIC 9(02).
01 INULL PIC X(01).
01 ITS-DECIMAL PIC X(01).
01 ITS-NUMERIC PIC X(01).
01 ITS-TIMESTAMP PIC X(01).
01 ITS-TIME PIC X(01).
01 ITS-DATE PIC X(01).
01 ITS-CHAR PIC X(01).
01 ITS-VARCHAR PIC X(01).
01 ITS-VARCHAR-OR-CHAR PIC X(01).
01 ITS-NULL PIC X(01).
01 VARCHAR.
03 VARCHAR-LENGTH PIC S9(04) COMP.
03 VARCHAR-CONTENTS PIC X(32672).
01 COULD-BE-DECIMAL PIC X(01).
01 THE-INTEGER-PART.
03 NINE31V PIC 9(31)V.
03 THE-LEFT PIC X(31) REDEFINES NINE31V
01 THE-DECIMAL-PART.
03 VNINE31 PIC V9(31).
03 THE-RIGHT PIC X(31) REDEFINES VNINE31.
01 DECIMAL-POINT-COUNT PIC 9(03).
01 DECIMAL-POINT-AT PIC 9(03).
01 MINUS-SIGN-COUNT PIC 9(03).
01 MINUS-SIGN-AT PIC 9(03).
01 BLANK-COUNT PIC 9(03).
01 FIRST-BLANK-AT PIC 9(03).
01 FIRST-BLANK PIC X(01).
01 NINE-COUNT PIC 9(03).
01 FIRST-NINE-AT PIC 9(03).
01 FIRST-NINE PIC X(01).
01 SPARE-1 PIC X(31).
01 SPARE-2 PIC X(31).
01 BLANKS PIC X(31)
VALUE 'bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb'.
01 NINES PIC X(31)
VALUE '9999999999999999999999999999999'.
01 LEN-NINES-B4 PIC 9(02).
01 START-AFTA-POINT PIC 9(02).
01 LEN-NINES-AFTA PIC 9(02).
01 THE-LEFT-START PIC 9(02).
01 THE-RIGHT-START PIC 9(02).
LINKAGE SECTION.
//02/// //03///PROCEDURE DIVISION USING MAINLINE.
DISPLAY 'GENER8 - ENTRY'
OPEN INPUT THE-FILE.
MOVE 'N' TO EOF.
PERFORM READ-THE-FILE.
IF EOF = 'Y'
DISPLAY 'DB2 -X BEING USED - BOMB'
STOP RUN
END-IF.
PERFORM VARYING SUB
FROM 1 BY 1
UNTIL SUB > 65000
OR THE-BACK-FOUND = 'Y'
MOVE THE-RECORD(SUB:2)
TO TWOCHAR
IF NOT TWOCHAR = '--'
AND NOT TWOCHAR = '- '
AND NOT TWOCHAR = ' -'
MOVE 'Y' TO THE-BACK-FOUND
END-IF
END-PERFORM.
IF THE-BACK-FOUND = 'Y'
ADD -1 TO SUB
MOVE SUB TO THE-BACK
ELSE
DISPLAY 'BACK NOT FOUND - BOMB'
STOP RUN
END-IF.
PERFORM VARYING SUB
FROM 1 BY 1
UNTIL SUB > THE-BACK
MOVE THE-RECORD(SUB:1) TO ONECHAR
IF SUB = THE-BACK
OR ONECHAR = ' '
ADD 1 TO TAB1
ADD SUB -1 GIVING A-TO
MOVE A-TO TO TA-TO(TAB1)
MOVE 0 TO TA-FROM(TAB1)
END-IF
END-PERFORM.
MOVE 1 TO TA-FROM(1).
PERFORM VARYING TAB2
FROM 2 BY 1
UNTIL TAB2 > TAB1
COMPUTE TAB3 = TAB2 - 1
MOVE TA-TO(TAB3) TO A-TO
ADD 2 A-TO GIVING A-FROM
MOVE A-FROM TO TA-FROM(TAB2)
END-PERFORM.
PERFORM VARYING TAB2
FROM 1 BY 1
UNTIL TAB2 > TAB1
MOVE TA-TO(TAB2) TO A-TO
MOVE TA-FROM(TAB2) TO A-FROM
COMPUTE A-LEN = A-TO - A-FROM + 1
MOVE A-LEN TO TA-LEN(TAB2)
END-PERFORM.
PERFORM VARYING TAB2
FROM 1 BY 1
UNTIL TAB2 > TAB1
MOVE TA-FROM(TAB2) TO A-FROM
move ta-to(tab2) to a-to
MOVE TA-LEN (TAB2) TO A-LEN
DISPLAY 'GENER8 4 tab2' tab2
'A-FROM' A-FROM
'A-TO ' A-TO
'a-len ' a-len
END-PERFORM.
PERFORM READ-FILE.
PERFORM VARYING TAB2
FROM 1 BY 1
UNTIL TAB2 > TAB1
MOVE TA-FROM(TAB2) TO A-FROM
MOVE TA-TO(TAB2) TO A-TO
MOVE TA-LEN(TAB2) TO A-LEN
MOVE 'N' TO ITS-NULL
MOVE THE-RECORD(A-FROM:2)
TO TWOCHAR
IF TWOCHAR = '- '
MOVE 'Y' TO ITS-NULL
END-IF
COMPUTE A-OFFSET = A-TO - 1
MOVE THE-RECORD(A-OFFSET:2)
TO TWOCHAR
IF TWOCHAR = ' -'
MOVE 'Y' TO ITS-NULL
END-IF
MOVE A-LEN TO A-WLEN
MOVE A-TO TO A-WTO
MOVE 'N' TO SPACE-NOT-FOUND
PERFORM VARYING CUB1
FROM A-TO BY -1
UNTIL CUB1 < A-FROM
OR SPACE-NOT-FOUND = 'Y'
MOVE THE-RECORD(CUB1:1) TO ONECHAR
IF ONECHAR = SPACE
COMPUTE A-WLEN = A-WLEN - 1
COMPUTE A-WTO = A-WTO - 1
ELSE
MOVE 'Y' TO SPACE-NOT-FOUND
END-IF
END-PERFORM
MOVE A-WLEN TO TA-WLEN(TAB2)
MOVE A-WTO TO TA-WTO (TAB2)
IF A-WLEN < 256
MOVE THE-RECORD(A-FROM:A-WLEN)
TO ACTULE
MOVE 0 TO CUB3
MOVE ALL '_' TO LISTSS
PERFORM VARYING CUB2
FROM A-FROM BY 1
UNTIL CUB2 > A-WTO
MOVE THE-RECORD(CUB2:1)
TO ONECHAR
ADD 1 TO CUB3
IF ONECHAR = ' '
MOVE 'b' TO LIST(CUB3)
END-IF
IF ONECHAR NOT > 'Z' AND
ONECHAR NOT < 'A'
MOVE 'X' TO LIST(CUB3)
END-IF
IF ONECHAR NOT > 'z' AND
ONECHAR NOT < 'a'
MOVE 'X' TO LIST(CUB3)
END-IF
IF ONECHAR NOT > '9' AND
ONECHAR NOT < '0'
MOVE '9' TO LIST(CUB3)
END-IF
IF ONECHAR = '+'
MOVE '+' TO LIST(CUB3)
END-IF
IF ONECHAR = '-'
MOVE '-' TO LIST(CUB3)
END-IF
IF ONECHAR = '.'
MOVE 'P' TO LIST(CUB3)
END-IF
IF ONECHAR = ','
MOVE ',' TO LIST(CUB3)
END-IF
IF ONECHAR = '/'
MOVE '/' TO LIST(CUB3)
END-IF
IF ONECHAR = ':'
MOVE ':' TO LIST(CUB3)
END-IF
IF LIST(CUB3) = '_'
MOVE ' ' TO LIST(CUB3)
END-IF
END-PERFORM
MOVE ITS-NULL TO INULL
MOVE 'N' TO ITS-NUMERIC
MOVE 'N' TO ITS-DECIMAL
MOVE 'N' TO ITS-TIMESTAMP
MOVE 'N' TO ITS-TIME
MOVE 'N' TO ITS-DATE
MOVE 'N' TO ITS-CHAR
MOVE 'N' TO ITS-VARCHAR
MOVE 'N' TO ITS-VARCHAR-OR-CHAR
MOVE 'N' TO ITS-NULL
IF INULL = 'N'
PERFORM VARYING CUB4
FROM 1 BY 1
UNTIL CUB4 > CUB3
IF LIST(CUB4) = 'b'
OR LIST(CUB4) = '9'
OR LIST(CUB4) = '-'
OR LIST(CUB4) = 'P'
OR LIST(CUB4) = ' '
MOVE 'Y' TO COULD-BE-DECIMAL
IF CUB4 = CUB3
PERFORM FURTHER-DECIMAL-CHECK
END-IF
ELSE
MOVE 'N' TO COULD-BE-DECIMAL
MOVE 256 TO CUB4
END-IF
END-PERFORM
IF COULD-BE-DECIMAL = 'N'
MOVE LISTSS(1:26)
TO TWENTY6CHAR
IF TWENTY6CHAR
= '9999-99-99-99P99P99P999999'
MOVE 'Y' TO ITS-TIMESTAMP
DISPLAY 'GENER8 - TIMESTAMP'
PERFORM TUP
ELSE
MOVE LISTSS(1:10)
TO TENCHAR
IF TENCHAR = '99/99/9999'
MOVE 'Y' TO ITS-DATE
DISPLAY 'GENER8 - DATE'
PERFORM TUP
ELSE
MOVE LISTSS(1:8)
TO EIGHTCHAR
IF EIGHTCHAR = '99:99:99'
MOVE 'Y' TO ITS-TIME
DISPLAY 'GENER8 - TIME'
PERFORM TUP
ELSE
PERFORM DO-THE-REST
END-IF
END-IF
END-IF
END-IF
ELSE
MOVE 'Y' TO ITS-NULL
PERFORM TUP
END-IF
ELSE
IF INULL = 'Y'
MOVE 'Y' TO ITS-NULL
DISPLAY 'GENER8 - VARCHAR NULL'
PERFORM TUP
ELSE
MOVE 'Y' TO ITS-VARCHAR
DISPLAY 'GENER8 - VARCHAR'
PERFORM TUP
END-IF
END-IF
END-PERFORM.
CLOSE THE-FILE.
DISPLAY 'GENER8 - EXIT'.
EXIT PROGRAM.
FURTHER-DECIMAL-CHECK SECTION.
MOVE 'Y' TO COULD-BE-DECIMAL.
MOVE ZERO TO DECIMAL-POINT-COUNT.
MOVE ZERO TO DECIMAL-POINT-AT.
PERFORM VARYING CUB4
FROM 1 BY 1
UNTIL CUB4 > CUB3
IF LIST(CUB4) = 'P'
IF DECIMAL-POINT-COUNT = 0
MOVE CUB4 TO DECIMAL-POINT-AT
END-IF
ADD 1 TO DECIMAL-POINT-COUNT
END-IF
END-PERFORM.
IF DECIMAL-POINT-COUNT NOT = 1
MOVE 'N' TO COULD-BE-DECIMAL
GO FDCX
END-IF.
MOVE ZERO TO MINUS-SIGN-COUNT.
MOVE ZERO TO MINUS-SIGN-AT.
PERFORM VARYING CUB4
FROM 1 BY 1
UNTIL CUB4 > CUB3
IF LIST(CUB4) = '-'
IF MINUS-SIGN-COUNT = 0
MOVE CUB4 TO MINUS-SIGN-AT
END-IF
ADD 1 TO MINUS-SIGN-COUNT
END-IF
END-PERFORM.
IF MINUS-SIGN-COUNT > 1
MOVE 'N' TO COULD-BE-DECIMAL
GO FDCX
END-IF.
MOVE ZERO TO BLANK-COUNT.
MOVE ZERO TO FIRST-BLANK-AT.
MOVE 'Y' TO FIRST-BLANK.
PERFORM VARYING CUB4
FROM 1 BY 1
UNTIL CUB4 > CUB3
IF LIST(CUB4) = 'b'
IF FIRST-BLANK = 'Y'
MOVE 'N' TO FIRST-BLANK
MOVE CUB4 TO FIRST-BLANK-AT
END-IF
ADD 1 TO BLANK-COUNT
END-IF
END-PERFORM.
MOVE ZERO TO NINE-COUNT.
MOVE ZERO TO FIRST-NINE-AT.
MOVE 'Y' TO FIRST-NINE.
PERFORM VARYING CUB4
FROM 1 BY 1
UNTIL CUB4 > CUB3
IF LIST(CUB4) = '9'
IF FIRST-NINE = 'Y'
MOVE 'N' TO FIRST-NINE
MOVE CUB4 TO FIRST-NINE-AT
END-IF
ADD 1 TO NINE-COUNT
END-IF
END-PERFORM.
IF NINE-COUNT > 31
OR NINE-COUNT = 0
MOVE 'N' TO COULD-BE-DECIMAL
GO FDCX
END-IF.
IF MINUS-SIGN-COUNT = 1
COMPUTE CUB5 = MINUS-SIGN-AT + 1
IF NOT LIST(CUB5) = 'P' AND
NOT LIST(CUB5) = '9'
MOVE 'N' TO COULD-BE-DECIMAL
GO FDCX
END-IF
END-IF.
CUB3 POINTS AT THE LAST CHARACTER IF THE LAST CHARACTER HAS THE DECIMAL POINT IN IT, THEN ALL THE NINES SHOULD IMMEDIATELY PRECEDE IT IF DECIMAL-POINT-AT = CUB3 MOVE SPACES TO SPARE-1 MOVE SPACES TO SPARE-2 MOVE LISTSS(FIRST-NINE-AT:NINE-COUNT) TO SPARE-1(1:NINE-COUNT) MOVE NINES(1:NINE-COUNT) TO SPARE-2(1:NINE-COUNT) IF NOT SPARE-1 = SPARE-2 MOVE 'N' TO COULD-BE-DECIMAL GO FDCX END-IF END-IF.
IF BLANK-COUNT > 0
MOVE SPACES TO SPARE-1
MOVE SPACES TO SPARE-2
MOVE LISTSS(FIRST-BLANK-AT:BLANK-COUNT)
TO SPARE-1(1:BLANK-COUNT)
MOVE BLANKS(1:BLANK-COUNT)
TO SPARE-2(1:BLANK-COUNT)
IF NOT SPARE-1 = SPARE-2
MOVE 'N' TO COULD-BE-DECIMAL
GO FDCX
END-IF
END-IF.
IF DECIMAL-POINT-AT < CUB3
MOVE SPACES TO SPARE-1
MOVE SPACES TO SPARE-2
COMPUTE LEN-NINES-B4 = DECIMAL-POINT-AT
- FIRST-NINE-AT
* + 1
MOVE LISTSS(FIRST-NINE-AT:LEN-NINES-B4)
TO SPARE-1(1:LEN-NINES-B4)
MOVE NINES(1:LEN-NINES-B4)
TO SPARE-2(1:LEN-NINES-B4)
IF NOT SPARE-1 = SPARE-2
MOVE 'N' TO COULD-BE-DECIMAL
GO FDCX
END-IF
MOVE SPACES TO SPARE-1
MOVE SPACES TO SPARE-2
* COMPUTE LEN-NINES-AFTA = 31
COMPUTE LEN-NINES-AFTA = NINE-COUNT
+ FIRST-NINE-AT
- DECIMAL-POINT-AT
COMPUTE START-AFTA-POINT = DECIMAL-POINT-AT
+ 1
MOVE LISTSS(START-AFTA-POINT:LEN-NINES-AFTA)
TO SPARE-1(1:LEN-NINES-AFTA)
MOVE NINES(1:LEN-NINES-AFTA)
TO SPARE-2(1:LEN-NINES-AFTA)
IF NOT SPARE-1 = SPARE-2
MOVE 'N' TO COULD-BE-DECIMAL
GO FDCX
END-IF
END-IF.
MOVE ZEROES TO NINE31V.
MOVE ZEROES TO VNINE31.
IF FIRST-NINE-AT < DECIMAL-POINT-AT
COMPUTE LEN-NINES-B4 = DECIMAL-POINT-AT
- FIRST-NINE-AT
* + 1
COMPUTE START-AFTA-POINT = DECIMAL-POINT-AT
+ 1
* COMPUTE LEN-NINES-AFTA = 31
COMPUTE LEN-NINES-AFTA = NINE-COUNT
+ FIRST-NINE-AT
- DECIMAL-POINT-AT
COMPUTE THE-LEFT-START = 31
- LEN-NINES-B4
+ 1
COMPUTE THE-RIGHT-START = 1
MOVE ACTULE(FIRST-NINE-AT:LEN-NINES-B4)
TO THE-LEFT(THE-LEFT-START:LEN-NINES-B4)
IF LEN-NINES-AFTA > 0
MOVE ACTULE(START-AFTA-POINT:LEN-NINES-AFTA)
TO THE-RIGHT(THE-RIGHT-START:LEN-NINES-AFTA)
END-IF
ELSE
* COMPUTE LEN-NINES-AFTA = 31
COMPUTE LEN-NINES-AFTA = NINE-COUNT
+ FIRST-NINE-AT
- DECIMAL-POINT-AT
COMPUTE START-AFTA-POINT = DECIMAL-POINT-AT
+ 1
COMPUTE THE-RIGHT-START = 1
MOVE ACTULE(START-AFTA-POINT:LEN-NINES-AFTA)
TO THE-RIGHT(THE-RIGHT-START:LEN-NINES-AFTA)
END-IF.
MOVE 'Y' TO ITS-DECIMAL.
PERFORM TUP.
FDCX. EXIT.
READ-THE-FILE SECTION.
RTFA.
READ THE-FILE
AT END
MOVE 'Y' TO EOF
END-READ.
IF EOF = 'N'
IF TR1 NOT = '-'
GO RTFA
else
display 'the-record-1-to-65'
the-record-1-to-65
END-IF
END-IF.
RTFX. EXIT.
READ-FILE SECTION.
READ THE-FILE
AT END
MOVE 'Y' TO EOF
END-READ.
if eof = 'N'
display 'the-record-1-to-65'
the-record-1-to-65
end-if.
RFX. EXIT.
DO-THE-REST SECTION.
MOVE 'N' TO MINERS
MOVE LISTSS(1:20)
TO TWENTYCHAR
MOVE TWENTYCHAR(20:1)
TO ONECHAR
MOVE 0 TO KOUNT
IF ONECHAR = '9'
ADD 1 TO KOUNT
PERFORM VARYING HUB2
FROM 19 BY -1
UNTIL HUB2 = 0
MOVE TWENTYCHAR(HUB2:1)
TO ONECHAR
IF ONECHAR = '-'
MOVE 'Y' TO MINERS
ELSE
IF ONECHAR = '9'
ADD 1 TO KOUNT
ELSE
MOVE 1 TO HUB2
END-IF
END-IF
END-PERFORM
MOVE ZEROES TO LONG-NUMERIC
COMPUTE KOUNT2 = 21 - KOUNT
COMPUTE KOUNT3 = 21 - KOUNT2
MOVE ACTULE(KOUNT2:KOUNT3)
TO LONG-NUMERIC(KOUNT2:KOUNT3)
IF MINERS = 'Y'
COMPUTE SIGNED-LONG-NUMERIC
=
0
-
LONG-NUMERIC
ELSE
COMPUTE SIGNED-LONG-NUMERIC
=
LONG-NUMERIC
END-IF
MOVE 'Y' TO ITS-NUMERIC
DISPLAY 'GENER8 - NUMERIC'
PERFORM TUP
GO DTRX
END-IF.
MOVE 'N' TO MINERS
MOVE LISTSS(1:11)
TO ELEVENCHAR
MOVE ELEVENCHAR(11:1)
TO ONECHAR
MOVE 0 TO KOUNT
IF ONECHAR = '9'
ADD 1 TO KOUNT
PERFORM VARYING HUB2
FROM 10 BY -1
UNTIL HUB2 = 0
MOVE ELEVENCHAR(HUB2:1)
TO ONECHAR
IF ONECHAR = '-'
MOVE 'Y' TO MINERS
ELSE
IF ONECHAR = '9'
ADD 1 TO KOUNT
ELSE
MOVE 1 TO HUB2
END-IF
END-IF
END-PERFORM
MOVE ZEROES TO LONG-NUMERIC
COMPUTE KOUNT2 = 21 - KOUNT
COMPUTE KOUNT3 = 21 - KOUNT2
COMPUTE KOUNT4 = 12 - KOUNT
COMPUTE KOUNT5 = 12 - KOUNT4
MOVE ACTULE(KOUNT4:KOUNT5)
TO LONG-NUMERIC(KOUNT2:KOUNT3)
IF MINERS = 'Y'
COMPUTE SIGNED-LONG-NUMERIC
=
0
-
LONG-NUMERIC
ELSE
COMPUTE SIGNED-LONG-NUMERIC
=
LONG-NUMERIC
END-IF
MOVE 'Y' TO ITS-NUMERIC
DISPLAY 'GENER8 - NUMERIC'
PERFORM TUP
GO DTRX
END-IF.
MOVE 'N' TO MINERS
MOVE LISTSS(1:8)
TO EIGHTCHAR
MOVE EIGHTCHAR(8:1)
TO ONECHAR
MOVE 0 TO KOUNT
IF ONECHAR = '9'
ADD 1 TO KOUNT
PERFORM VARYING HUB2
FROM 7 BY -1
UNTIL HUB2 = 0
MOVE EIGHTCHAR(HUB2:1)
TO ONECHAR
IF ONECHAR = '-'
MOVE 'Y' TO MINERS
ELSE
IF ONECHAR = '9'
ADD 1 TO KOUNT
ELSE
MOVE 1 TO HUB2
END-IF
END-IF
END-PERFORM
MOVE ZEROES TO LONG-NUMERIC
COMPUTE KOUNT2 = 21 - KOUNT
COMPUTE KOUNT3 = 21 - KOUNT2
COMPUTE KOUNT4 = 9 - KOUNT
COMPUTE KOUNT5 = 9 - KOUNT4
MOVE ACTULE(KOUNT4:KOUNT5)
TO LONG-NUMERIC(KOUNT2:KOUNT3)
IF MINERS = 'Y'
COMPUTE SIGNED-LONG-NUMERIC
=
0
-
LONG-NUMERIC
ELSE
COMPUTE SIGNED-LONG-NUMERIC
=
LONG-NUMERIC
END-IF
MOVE 'Y' TO ITS-NUMERIC
DISPLAY 'GENER8 - NUMERIC'
PERFORM TUP
GO DTRX
END-IF.
IF INULL = 'Y'
MOVE 'Y' TO ITS-NULL
DISPLAY 'GENER8 - VARCHAR/CHAR NULL'
PERFORM TUP
ELSE
MOVE 'Y' TO ITS-VARCHAR-OR-CHAR
DISPLAY 'GENER8 - VARCHAR/CHAR'
PERFORM TUP
END-IF.
DTRX. EXIT.
*
TUP SECTION.
*TUP IS PUT BACK.
*
ADD 1 TO ANO-COUNT.
*
//04// * TX. EXIT.
ECHO ON REM This is DB2CRE7.BIN which is a template for REM DB2PREPZ.CBL to generate SQL3.BAT. REM DB2PREPZ will then run start3,wread3,stop3 REM which will submit SQL3.BAT and have it run REM through the modified CMDPROC.
REM DB2CRE7 Calls DB2CRE8.BAT that creates the REM IIPPPPNN.CBL programs that put back REM DB2 values into the Target's host REM variables. REM REM DB2CRE7 receives II as the runner's REM initials and PPPP as the target REM program's abbreviated program name REM as parameters. REM REM NN is a value that is generated from REM DB2PREPZ which uses this file (DB2CRE7.BIN) REM as a template when it creates DB2CRE7.BAT REM REM NN being the last 2 digits of the target REM program's SQL Sequence Id (e.g. the 03 REM of SQL003) which denote every DB2 SQL REM statement in the target program. REM REM The value of NN used here will only apply REM to those DB2 SQL statements that are REM SELECT or FETCH, as they have DB2 values REM that should be put back in the target's host REM variables.
REM There should be a DB2CRE8 line following REM for each NN value that DB2PREPZ wants an REM IIPPPPNN.CBL for, which should have the REM DB2CRE8 parameter1, parameter2,NN REM e.g. DB2CRE8 JH,TES2,03 REM REM As DB2CRE7.BAT and DB2CRE8.BAT and CBL are REM to be run via the modified CMDPROC one should REM be cognisant of the same timing out should REM the underlying processes take too long. REM Maybe use of the asynchronous START should REM be used instead of CALL. REM
//01/// CALL or START DB2CRE8 II,PPPP,NN
REM CRE7 END REM END
REM I DON'T THINK WE WANT THIS ANYMORE ECHO ON REM Tis file is DB2CRE8.BIN and is a template REM for DB2PREPZ.CBL which creates the DB2CRE8.BAT file REM which is run via SQL3.BAT (DB2CRE7.BIN) which is also REM created by DB2PREPZ.
REM DB2CRE8.BAT is generated and run by REM DB2PREPZ for each of the generated zcobol programs. REM that are called by the target program to put back REM the DB2 values into its zcobol host variables REM for each DB2 SQL SELECT or FETCH
ECHO %1 > PID.OUT SET CRE8PID=PID.OUT ECHO %2 > SEQ.OUT SET CRE8SEQ=SEQ.OUT SET CRE8IN=\ZCOBOL\DEMO\JHTES2YY.CBL SET CRE8IN2=\ZCOBOL\DEMO\TARGET.CBL SET CRE8OUT=\ZCOBOL\DEMO\%1%2%3.CBL SET CRE8ANO=ANO.OUT
call ZC390CLJ ZCOBOL\DEMO\DB2CRE8
if errorlevel 1 GOTO RUNIT_ERROR GOTO THEND
:RUNIT_ERROR ECHO ON ECHO DB2CRE8 BOMBED GOTO THEND
:THEND ECHO ON ECHO THEND
ECHO ON REM DB2PREPY Comments out SQL of target zcobol program REM and compiles it to get workstor fields in ERR file REM
cd c:\z390
SET COBDIR=ZCOBOL\DEMO\
SET INFILE=%COBDIR%%1.SQB SET OUTFILE=%COBDIR%%1.CBL
call ZC390CLG ZCOBOL\DEMO\DB2PREPY NOTIME if errorlevel 1 GOTO DB2PREPY_ERROR GOTO NEXTPART
:DB2PREPY_ERROR ECHO ON ECHO DB2PREPY BOMBED GOTO THEND
:NEXTPART call ZC390C %COBDIR%%1 if errorlevel 1 GOTO RONG GOTO THEND
:RONG ECHO ON ECHO COMPILE OF %1 BOMBED GOTO THEND
:THEND
ECHO OFF REM DB2PREPZ Converts an Embedded SQL zcobol program REM and runs it REM
cd c:\z390
if [%1] == [] goto error1 if [%2] == [] goto error2 if [%3] == [] goto error3 if [%4] == [] goto error4 goto paramsOK
:error1 echo TARGET PROGRAM NAME as parameter 1 omitted exit /b
:error2 echo YOUR INITIALS as parameter 2 omitted exit /b
:error3 echo ABBREVIATED PROGRAM NAME as parameter 3 omitted exit /b
:error4 echo DATABASE NAME as parameter 4 omitted exit /b
:paramsOK
ECHO OFF SET COBDIR=ZCOBOL\DEMO\
set DB2INSTANCE=MYINST1 db2clpsetcp
erase database.out echo %4 > database.out SET DATABASE=database.out
ECHO CONNECT TO %4~ > SQL.BAT call db2 -vac -td~ -f SQL.BAT
ERASE SQL.BAT
REM DB2 OPTIONS REM -v This option tells the command line processor to echo REM command text to standard output. REM -a This option tells the command line processor to display REM SQLCA data. REM -c This option tells the command line processor to REM automatically commit SQL statements. REM -td~ This option tells the command line processor to define REM and to use ~ as the statement termination character REM -f This option tells the command line processor to read REM command input from a file instead of from standard input. REM -z This option tells the command line processor to redirect REM all output to a file. It is similar to the -r option, REM but includes any messages or error codes with the output. REM -e{c|s} This option tells the command line processor to display REM SQLCODE or SQLSTATE. These options are mutually exclusive REM -x This option tells the command line processor to return data REM without any headers, including column names. REM ECHO TYPE C:\Z390\%COBDIR%%1.SQI > SQL.BAT ECHO ERASE C:\Z390\SQL.RES >> SQL.BAT set string1=call db2 -va -ec +c -x -td~ -f c:\z390\%COBDIR%%1 set string2=.sqi -z C:\Z390\SQL.RES ECHO %string1%%string2% >> SQL.BAT ECHO REM END >> SQL.BAT
TYPE SQL.BAT
ECHO %1 > TARGET.OUT SET CRE8TARG=TARGET.OUT ECHO %2 > INITS.OUT SET CRE8INTS=INITS.OUT ECHO %3 > PID.OUT SET CRE8PID=PID.OUT
SET ERRFILE=%COBDIR%%1.ERR SET SQLFILE=%COBDIR%%1.SQL SET SQLSTMT=SQL.BAT SET SQLIN=%COBDIR%%1.SQI SET SQLRES=SQL.RES REM 221122 KAZAK SET ANOFILE=ANO.OUT
SET INFILE=%COBDIR%%1.SQB SET OUTFILE=%COBDIR%%1.CBL
SET CRE7BIN=CRE7BIN.BIN SET CRE7SQL3=SQL3.BAT
call ZC390CLJ %COBDIR%DB2PREPZ,NOTIME ECHO the errorlevel was %errorlevel% if errorlevel 1 GOTO DB2PREPZ_ERROR GOTO NEXTPART
:DB2PREPZ_ERROR ECHO ON ECHO DB2PREPZ BOMBED GOTO THEND
:NEXTPART
ECHO CONNECT RESET~ > sql.bat call db2 -vac -td~ -f SQL.BAT
ECHO TERMINATE~ > sql.bat call db2 -vac -td~ -f SQL.BAT
ECHO QUIT~ > sql.bat call db2 -a -td~ -f SQL.BAT
ERASE SQL.BAT
ECHO ON
:THEND EXIT /B
cmd /c exit -1073741510 Y EXIT /B
ECHO OFF REM DB2CRE8.BAT is run via DB2CRE7.BAT
ECHO %1 ECHO %2 ECHO %3 ECHO %4
cd c:\z390
SET COBDIR=ZCOBOL\DEMO\
ECHO %1 > INITS.OUT SET CRE8INTS=INITS.OUT ECHO %2 > PID.OUT SET CRE8PID=PID.OUT ECHO %3 > SEQ.OUT SET CRE8SEQ=SEQ.OUT
SET CRE8IN=c:\z390\%COBDIR%JHTES2YY.CBL SET CRE8IN2=c:\z390\%COBDIR%%4.sqb ECHO %1%2%3 SET CRE8OUT=c:\z390\%COBDIR%%1%2%3.CBL SET CRE8ANO=ANO.OUT
call ZC390CLJ %COBDIR%DB2CRE8,NOTIME,NOTIMING REM END
ECHO ON REM NUATEST2 - runs TESTALL2 REM
SET DB2INSTANCE=MYINST1 DB2CLPSETCP
ECHO CONNECT TO CHOOKY~ > sql.bat call db2 -vac -td~ -f SQL.BAT
REM DB2 OPTIONS REM -v This option tells the command line processor to echo REM command text to standard output. REM -a This option tells the command line processor to display REM SQLCA data. REM -c This option tells the command line processor to REM automatically commit SQL statements. REM -td~ This option tells the command line processor to define REM and to use ~ as the statement termination character REM -f This option tells the command line processor to read REM command input from a file instead of from standard input. REM -z This option tells the command line processor to redirect REM all output to a file. It is similar to the -r option, REM but includes any messages or error codes with the output. REM -e{c|s} This option tells the command line processor to display REM SQLCODE or SQLSTATE. These options are mutually exclusive REM -x This option tells the command line processor to return data REM without any headers, including column names. REM REM ECHO TYPE C:\Z390\TESTALL2.SQI > SQL.BAT ECHO ERASE C:\Z390\SQL.RES > SQL.BAT set string1=call db2 -va -ec -td~ -f c:\z390\TESTALL2 set string2=.sqi -z C:\Z390\SQL.RES ECHO %string1%%string2% >> SQL.BAT ECHO COPY SQL.RES SQL.CPY >> SQL.BAT ECHO REM END >> SQL.BAT
rem REM THE SECOND DEL IS TO GET A MSG FROM THE OS TO SAY rem REM THAT THE FILE CANNOT BE FOUND
REM ECHO DEL C:\Z390\DISPLAY.TXT > SQL2.BAT REM ECHO DEL C:\Z390\DISPLAY.TXT >> SQL2.BAT REM ECHO REM END >> SQL2.BAT
SET ERRFILE=C:\Z390\ZCOBOL\DEMO\TESTALL2.ERR SET SQLFILE=C:\Z390\ZCOBOL\DEMO\TESTALL2.SQL SET SQLSTMT=C:\Z390\SQL.BAT REM SET DOSCMD2=C:\Z390\SQL2.BAT SET SQLIN=C:\Z390\TESTALL2.SQI SET SQLRES=SQL.RES SET SQLCPY=SQL.CPY SET DISPFILE=C:\Z390\DISPLAY.TXT
CD C:\Z390
call ZC390CLJ ZCOBOL\DEMO\TESTALL2
if errorlevel 1 GOTO RUNIT_ERROR
GOTO THEND
:RUNIT_ERROR ECHO ON ECHO NUATEST2 BOMBED GOTO THEND
:THEND ECHO ON ECHO THEND
ECHO OFF REM SETUPEMP sets up table EMP in CHOOKY REM
ECHO ON set DB2INSTANCE=MYINST1 db2clpsetcp
ECHO CONNECT TO CHOOKY~ > SQL.BAT call db2 -vac -td~ -f SQL.BAT
ECHO DROP TABLE EMP~ > SQL.BAT call db2 -vac -td~ -f SQL.BAT
ECHO CREATE TABLE EMP( > SQL.BAT ECHO EMPNO CHAR(06) NOT NULL, >> SQL.BAT ECHO FIRSTNME CHAR(12), >> SQL.BAT ECHO MIDINIT CHAR(01) NOT NULL, >> SQL.BAT ECHO PRIMARY KEY (EMPNO))~ >> SQL.BAT call db2 -vac -td~ -f SQL.BAT
ECHO INSERT INTO EMPL (empno, firstnme, midinit) VALUES ('000005', 'JOHN ', 'C')~ > sql.bat call db2 -vac -td~ -f SQL.BAT
ECHO INSERT INTO EMP (empno, firstnme, midinit) VALUES ('000010', 'CHRISTINE ', 'K')~ > sql.bat call db2 -vac -td~ -f SQL.BAT
ECHO INSERT INTO EMP (empno, midinit) VALUES ('000015', 'Z')~ > sql.bat call db2 -vac -td~ -f SQL.BAT
ECHO SELECT * FROM EMP~ > sql.bat call db2 -vac -td~ -f SQL.BAT
ECHO CONNECT RESET~ > sql.bat call db2 -vac -td~ -f SQL.BAT
ECHO TERMINATE~ > sql.bat call db2 -vac -td~ -f SQL.BAT
ECHO QUIT~ > sql.bat call db2 -a -td~ -f SQL.BAT
:THEND ECHO ON ECHO THEND
ECHO OFF
REM DB2DATA sets up table DB2DATA in CHOOKY
REM that houses all the data types
REM that I'll support in my version
REM of ZCOBOL Embedded DB2.
REM It'll DESCRIBE that table to ensure
REM fields have the correct data type.
REM Those fields will be populated.
REM (There'll be 2 rows INSERTed.
REM one - with all non-NULL data,
REM two - with non-NULL data in even data types
REM and with NULLs in odd data types)
REM Finally 2 SELECTs will be written
REM (one - that'll retrieve 2 rows of
REM even data types, two - that'll retrieve
REM 2 rows of odd data types)
REM that will extract those fields in HEX
REM that'll fit within ZCOBOL fields.
REM
REM
REM Data types 456 and 457 (long varchar) REMoved
REM
REM Data types 384/385(date), 388/389(time), 392/393(timestamp)
REM are to be treated as CHARacter fields
REM
REM Data types 448/449(varchar) are headed by a 2 byte length field
REM whose bytes are the reverse order of zcobol COMP fields,
REM the remainder are to be treated as CHARacter bytes
REM
REM Data types 452/453(char) are to be treated as CHARacter fields
REM
REM Data types 484/485(decimal), 492/493(bigint), 496/497(integer),
REM 500/501(smallint) will be represented by HEX pairs
REM
REM Arbitrary lengths have been chosen for varchar fields of 256 bytes
REM Arbitrary lengths have been chosen for char fields of 32 bytes
REM Arbitrary precisio and scale have been chosen for decimal fields
REM of 9 and 2
REM
ECHO ON set DB2INSTANCE=MYINST1 db2clpsetcp
ECHO 01 ECHO CONNECT TO CHOOKY~ > SQL.BAT call db2 -vac -td~ -f SQL.BAT
ECHO 02 ECHO DROP TABLE DB2DATA~ > SQL.BAT call db2 -vac -td~ -f SQL.BAT
ECHO 03 ECHO CREATE TABLE DB2DATA( > SQL.BAT ECHO FIELD384 DATE NOT NULL, >> SQL.BAT ECHO FIELD385 DATE DEFAULT NULL, >> SQL.BAT ECHO FIELD388 TIME NOT NULL, >> SQL.BAT ECHO FIELD389 TIME DEFAULT NULL, >> SQL.BAT ECHO FIELD392 TIMESTAMP NOT NULL, >> SQL.BAT ECHO FIELD393 TIMESTAMP DEFAULT NULL, >> SQL.BAT ECHO FIELD448 VARCHAR(256) NOT NULL, >> SQL.BAT ECHO FIELD449 VARCHAR(256), >> SQL.BAT ECHO FIELD452 CHAR(255) NOT NULL, >> SQL.BAT ECHO FIELD453 CHAR(255), >> SQL.BAT ECHO FIELD484 DECIMAL(9,2) NOT NULL, >> SQL.BAT ECHO FIELD485 DECIMAL(9,2), >> SQL.BAT ECHO FIELD492 BIGINT NOT NULL, >> SQL.BAT ECHO FIELD493 BIGINT, >> SQL.BAT ECHO FIELD496 INTEGER NOT NULL, >> SQL.BAT ECHO FIELD497 INTEGER, >> SQL.BAT ECHO FIELD500 SMALLINT NOT NULL, >> SQL.BAT ECHO FIELD501 SMALLINT)~ >> SQL.BAT call db2 -vac -td~ -f SQL.BAT
ECHO 04 ECHO INSERT INTO DB2DATA( > SQL.BAT ECHO FIELD384, >> SQL.BAT ECHO FIELD385, >> SQL.BAT ECHO FIELD388, >> SQL.BAT ECHO FIELD389, >> SQL.BAT ECHO FIELD392, >> SQL.BAT ECHO FIELD393, >> SQL.BAT ECHO FIELD448, >> SQL.BAT ECHO FIELD449, >> SQL.BAT ECHO FIELD452, >> SQL.BAT ECHO FIELD453, >> SQL.BAT ECHO FIELD484, >> SQL.BAT ECHO FIELD485, >> SQL.BAT ECHO FIELD492, >> SQL.BAT ECHO FIELD493, >> SQL.BAT ECHO FIELD496, >> SQL.BAT ECHO FIELD497, >> SQL.BAT ECHO FIELD500, >> SQL.BAT ECHO FIELD501 >> SQL.BAT ECHO ) >> SQL.BAT ECHO VALUES ( >> SQL.BAT ECHO '2022-03-14', >> SQL.BAT ECHO NULL, >> SQL.BAT ECHO '01:02:03', >> SQL.BAT ECHO NULL, >> SQL.BAT ECHO CURRENT TIMESTAMP, >> SQL.BAT ECHO NULL, >> SQL.BAT ECHO 'ABCDEFG', >> SQL.BAT ECHO NULL, >> SQL.BAT ECHO 'THIS IS A FIXED LENGTH STRING 32', >> SQL.BAT ECHO NULL, >> SQL.BAT REM ECHO 'A VERY LONG VARIABLE FIELD', >> SQL.BAT REM ECHO 'THIS IS A VERY LONG VARIABLE FIELD', >> SQL.BAT ECHO -0000001.23, >> SQL.BAT ECHO NULL, >> SQL.BAT ECHO -000000000000000123, >> SQL.BAT ECHO NULL, >> SQL.BAT ECHO -000000123, >> SQL.BAT ECHO NULL, >> SQL.BAT ECHO -0123, >> SQL.BAT ECHO NULL >> SQL.BAT ECHO )~ >> sql.bat call db2 -vac -td~ -f SQL.BAT
ECHO SELECT * FROM DB2DATA~ > sql.bat call db2 -vac -td~ -f SQL.BAT > SQL.RES
ECHO 12 ECHO CONNECT RESET~ > sql.bat call db2 -vac -td~ -f SQL.BAT
ECHO 13 ECHO TERMINATE~ > sql.bat call db2 -vac -td~ -f SQL.BAT
ECHO 14 ECHO QUIT~ > sql.bat call db2 -a -td~ -f SQL.BAT
:THEND ECHO ON ECHO THEND
01 SQLCA.
05 SQLCAID PIC X(8) VALUE "SQLCA ".
05 SQLCABC PIC S9(9) COMP VALUE 136.
05 SQLCODE PIC S9(9) COMP VALUE 0.
05 SQLERRM.
49 SQLERRML PIC S9(4) COMP.
49 SQLERRMC PIC X(70).
05 SQLERRP PIC X(8).
05 SQLERRD PIC S9(9) COMP OCCURS 6 VALUE 0.
05 SQLWARN.
10 SQLWARN0 PIC X.
10 SQLWARN1 PIC X.
10 SQLWARN2 PIC X.
10 SQLWARN3 PIC X.
10 SQLWARN4 PIC X.
10 SQLWARN5 PIC X.
10 SQLWARN6 PIC X.
10 SQLWARN7 PIC X.
10 SQLWARN8 PIC X.
10 SQLWARN9 PIC X.
10 SQLWARN10 PIC X.
10 SQLWARNA PIC X REDEFINES SQLWARN10.
05 SQLSTATE PIC X(5).
TITLE 'START1 - START COMMAND PROCESSOR'
START1 SUBENTRY
TITLE 'START2 - START COMMAND PROCESSOR 2'
START2 SUBENTRY
TITLE 'START3 - START COMMAND PROCESSOR 3'
START3 SUBENTRY
TITLE 'WREAD1 - WRITE TO COMMAND PROCESSOR'
WREAD1 SUBENTRY
TITLE 'WREAD2 - WRITE TO COMMAND PROCESSOR2'
WREAD2 SUBENTRY GETENV DOSCMD2 CMDPROC WRITE,(R2),ID=2
TITLE 'WREAD3 - WRITE TO AND READ FROM COMMAND PROCESSOR3'
WREAD3 SUBENTRY GETENV CRE7SQL3 CMDPROC WRITE,(R2),ID=3
TITLE 'STOP1 - STOP COMMAND PROCESSOR'
STOP1 SUBENTRY
TITLE 'STOP2 - STOP COMMAND PROCESSOR2'
STOP2 SUBENTRY
TITLE 'STOP3 - STOP COMMAND PROCESSOR3'
STOP3 SUBENTRY
CHANGE TO GEN_BASE.MAC
.* JCLH IILF &BASE_B2,&SYM_NAME(&IX)-WS IILF &BASE_B2,&SYM_NAME(&IX)-ZC_WS_START
CHANGE TO WS.MAC
ACALL WS_END_PRIOR
. . ADD NEW LEVEL # AT SAME OR HIGHER LEVEL .* AIF (&WS_LVL EQ 0) ACALL WS_ADD_LVL AELSEIF (&NEW_LVL_NO GT &WS_LVL_NO(&WS_LVL)) ACALL WS_ADD_LVL AEND AIF (&WS_LVL EQ 1) :&WS_LVL_RDEF(1) SETB 0 RESET REDEFINE AT LVL 1 :&WS_LVL_USE(1) SETC '' RESET GROUP USAGE AT LVL 1 AEND ACALL WS_STORE_NN AIF (&FILE_IX GT 0) AIF (&FILE_RECORD(&FILE_IX) EQ '') :&FILE_RECORD(&FILE_IX) SETC '&SYM_NAME(&SYM_TOT)' AEND AEND AIF (&WS_LVL EQ 1 AND '&PIC' EQ '') :&WS_LVL_USE(1) SETC '&USAGE' SET NEW LVL 1 USAGE DEF AEND :&WS_LVL_SYM_IX(&WS_LVL) SETA &SYM_TOT WS_LVL SYM INDEX
:&d1 setc '&SYM_NAME(&SYM_TOT)'
:&d2 setc '&SYM_LVL(&SYM_TOT)'
:&d3 setc '&SYM_LOC(&SYM_TOT)'
:&d4 setc '&SYM_LEN(&SYM_TOT)'
:&d5 setc '&SYM_PIC(&SYM_TOT)'
:&d6 setc '&SYM_PIC_TYPE(&SYM_TOT)'
:&d7 setc '&SYM_PIC_SIGN(&SYM_TOT)'
:&d8 setc '&SYM_PIC_DEC(&SYM_TOT)'
mnote 0,'workstor &d1 &d2 &d3 &d4 &d5 &d6 &d7 &d8'
IDENTIFICATION DIVISION.
PROGRAM-ID. CB002.
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
DATA DIVISION.
FILE SECTION.
WORKING-STORAGE SECTION.
01 SUB1 PIC 9 VALUE 1.
01 SUB2 PIC 9 COMP VALUE 1.
01 SUB3 PIC 9 COMP-3 VALUE 1.
01 DDUB1 PIC 9(01) value 1.
01 DDUB2 PIC 9(02) value 2.
01 DDUB3 PIC 9(03) value 3.
01 DDUB4 PIC 9(04) value 4.
01 DDUB5 PIC 9(05) value 5.
01 DDUB6 PIC 9(06) value 6.
01 D3UB1 PIC 9(01) value 1.
01 D3UB2 PIC 9(02) value 2.
01 D3UB3 PIC 9(03) value 3.
01 D3UB4 PIC 9(04) value 4.
01 D3UB5 PIC 9(05) value 5.
01 D3UB6 PIC 9(06) value 6.
01 DBUB1 PIC 9(01) value 1.
01 DBUB2 PIC 9(02) value 2.
01 DBUB3 PIC 9(03) value 3.
01 DBUB4 PIC 9(04) value 4.
01 DBUB5 PIC 9(05) value 5.
01 DBUB6 PIC 9(06) value 6.
01 AUB1 PIC 9(01) value 0.
01 AUB2 PIC 9(02) value 0.
01 AUB3 PIC 9(03) value 0.
01 AUB4 PIC 9(04) value 0.
01 AUB5 PIC 9(05) value 0.
01 AUB6 PIC 9(06) value 0.
01 BUB1 PIC 9(01) COMP-3 value 0.
01 BBUB2 PIC 9(02) COMP-3 value 0.
01 BUB3 PIC 9(03) COMP-3 value 0.
01 BUB4 PIC 9(04) COMP-3 value 0.
01 BUB5 PIC 9(05) COMP-3 value 0.
01 BUB6 PIC 9(06) COMP-3 value 0.
01 CUB1 PIC 9(01) COMP value 0.
01 CUB2 PIC 9(02) COMP value 0.
01 CUB3 PIC 9(03) COMP value 0.
01 CUB4 PIC 9(04) COMP value 0.
01 CUB5 PIC 9(05) COMP value 0.
01 CUB6 PIC 9(06) COMP value 0.
LINKAGE SECTION.
PROCEDURE DIVISION.
MAINLINE-SECTION.
DISPLAY 'RECEIVING FIELD DECIMAL'.
DISPLAY '1 DECIMAL'.
SUBTRACT 1 FROM DDUB1 GIVING AUB1.
SUBTRACT 1 FROM DDUB1 GIVING AUB2.
SUBTRACT 1 FROM DDUB1 GIVING AUB3.
SUBTRACT 1 FROM DDUB1 GIVING AUB4.
SUBTRACT 1 FROM DDUB1 GIVING AUB5.
SUBTRACT 1 FROM DDUB1 GIVING AUB6.
DISPLAY AUB1 AUB2 AUB3 AUB4 AUB5 AUB6.
SUBTRACT 1 FROM DDUB2 GIVING AUB2.
SUBTRACT 1 FROM DDUB2 GIVING AUB3.
SUBTRACT 1 FROM DDUB2 GIVING AUB4.
SUBTRACT 1 FROM DDUB2 GIVING AUB5.
SUBTRACT 1 FROM DDUB2 GIVING AUB6.
DISPLAY AUB2 AUB3 AUB4 AUB5 AUB6.
SUBTRACT 1 FROM DDUB3 GIVING AUB3.
SUBTRACT 1 FROM DDUB3 GIVING AUB4.
SUBTRACT 1 FROM DDUB3 GIVING AUB5.
SUBTRACT 1 FROM DDUB3 GIVING AUB6.
DISPLAY AUB3 AUB4 AUB5 AUB6.
SUBTRACT 1 FROM DDUB4 GIVING AUB4.
SUBTRACT 1 FROM DDUB4 GIVING AUB5.
SUBTRACT 1 FROM DDUB4 GIVING AUB6.
DISPLAY AUB4 AUB5 AUB6.
SUBTRACT 1 FROM DDUB5 GIVING AUB5.
SUBTRACT 1 FROM DDUB5 GIVING AUB6.
DISPLAY AUB5 AUB6.
SUBTRACT 1 FROM DDUB6 GIVING AUB6.
DISPLAY AUB6.
DISPLAY '2 COMP-3'.
SUBTRACT 1 FROM D3UB1 GIVING AUB1.
SUBTRACT 1 FROM D3UB1 GIVING AUB2.
SUBTRACT 1 FROM D3UB1 GIVING AUB3.
SUBTRACT 1 FROM D3UB1 GIVING AUB4.
SUBTRACT 1 FROM D3UB1 GIVING AUB5.
SUBTRACT 1 FROM D3UB1 GIVING AUB6.
DISPLAY AUB1 AUB2 AUB3 AUB4 AUB5 AUB6.
SUBTRACT 1 FROM D3UB2 GIVING AUB2.
SUBTRACT 1 FROM D3UB2 GIVING AUB3.
SUBTRACT 1 FROM D3UB2 GIVING AUB4.
SUBTRACT 1 FROM D3UB2 GIVING AUB5.
SUBTRACT 1 FROM D3UB2 GIVING AUB6.
DISPLAY AUB2 AUB3 AUB4 AUB5 AUB6.
SUBTRACT 1 FROM D3UB3 GIVING AUB3.
SUBTRACT 1 FROM D3UB3 GIVING AUB4.
SUBTRACT 1 FROM D3UB3 GIVING AUB5.
SUBTRACT 1 FROM D3UB3 GIVING AUB6.
DISPLAY AUB3 AUB4 AUB5 AUB6.
SUBTRACT 1 FROM D3UB4 GIVING AUB4.
SUBTRACT 1 FROM D3UB4 GIVING AUB5.
SUBTRACT 1 FROM D3UB4 GIVING AUB6.
DISPLAY AUB4 AUB5 AUB6.
SUBTRACT 1 FROM D3UB5 GIVING AUB5.
SUBTRACT 1 FROM D3UB5 GIVING AUB6.
DISPLAY AUB5 AUB6.
SUBTRACT 1 FROM D3UB6 GIVING AUB6.
DISPLAY AUB6.
DISPLAY '3 BINARY'.
SUBTRACT 1 FROM DBUB1 GIVING AUB1.
SUBTRACT 1 FROM DBUB1 GIVING AUB2.
SUBTRACT 1 FROM DBUB1 GIVING AUB3.
SUBTRACT 1 FROM DBUB1 GIVING AUB4.
SUBTRACT 1 FROM DBUB1 GIVING AUB5.
SUBTRACT 1 FROM DBUB1 GIVING AUB6.
DISPLAY AUB1 AUB2 AUB3 AUB4 AUB5 AUB6.
SUBTRACT 1 FROM DBUB2 GIVING AUB2.
SUBTRACT 1 FROM DBUB2 GIVING AUB3.
SUBTRACT 1 FROM DBUB2 GIVING AUB4.
SUBTRACT 1 FROM DBUB2 GIVING AUB5.
SUBTRACT 1 FROM DBUB2 GIVING AUB6.
DISPLAY AUB2 AUB3 AUB4 AUB5 AUB6.
SUBTRACT 1 FROM DBUB3 GIVING AUB3.
SUBTRACT 1 FROM DBUB3 GIVING AUB4.
SUBTRACT 1 FROM DBUB3 GIVING AUB5.
SUBTRACT 1 FROM DBUB3 GIVING AUB6.
DISPLAY AUB3 AUB4 AUB5 AUB6.
SUBTRACT 1 FROM DBUB4 GIVING AUB4.
SUBTRACT 1 FROM DBUB4 GIVING AUB5.
SUBTRACT 1 FROM DBUB4 GIVING AUB6.
DISPLAY AUB4 AUB5 AUB6.
SUBTRACT 1 FROM DBUB5 GIVING AUB5.
SUBTRACT 1 FROM DBUB5 GIVING AUB6.
DISPLAY AUB5 AUB6.
SUBTRACT 1 FROM DBUB6 GIVING AUB6.
DISPLAY AUB6.
DISPLAY 'RECEIVING FIELD COMP-3'.
DISPLAY '4 DECIMAL'.
SUBTRACT 1 FROM DDUB1 GIVING BUB1.
SUBTRACT 1 FROM DDUB1 GIVING BBUB2.
SUBTRACT 1 FROM DDUB1 GIVING BUB3.
SUBTRACT 1 FROM DDUB1 GIVING BUB4.
SUBTRACT 1 FROM DDUB1 GIVING BUB5.
SUBTRACT 1 FROM DDUB1 GIVING BUB6.
DISPLAY BUB1 BBUB2 BUB3 BUB4 BUB5 BUB6.
SUBTRACT 1 FROM DDUB2 GIVING BBUB2.
SUBTRACT 1 FROM DDUB2 GIVING BUB3.
SUBTRACT 1 FROM DDUB2 GIVING BUB4.
SUBTRACT 1 FROM DDUB2 GIVING BUB5.
SUBTRACT 1 FROM DDUB2 GIVING BUB6.
DISPLAY BBUB2 BUB3 BUB4 BUB5 BUB6.
SUBTRACT 1 FROM DDUB3 GIVING BUB3.
SUBTRACT 1 FROM DDUB3 GIVING BUB4.
SUBTRACT 1 FROM DDUB3 GIVING BUB5.
SUBTRACT 1 FROM DDUB3 GIVING BUB6.
DISPLAY BUB3 BUB4 BUB5 BUB6.
SUBTRACT 1 FROM DDUB4 GIVING BUB4.
SUBTRACT 1 FROM DDUB4 GIVING BUB5.
SUBTRACT 1 FROM DDUB4 GIVING BUB6.
DISPLAY BUB4 BUB5 BUB6.
SUBTRACT 1 FROM DDUB5 GIVING BUB5.
SUBTRACT 1 FROM DDUB5 GIVING BUB6.
DISPLAY BUB5 BUB6.
SUBTRACT 1 FROM DDUB6 GIVING BUB6.
DISPLAY BUB6.
DISPLAY '5 COMP-3'.
SUBTRACT 1 FROM D3UB1 GIVING BUB1.
SUBTRACT 1 FROM D3UB1 GIVING BBUB2.
SUBTRACT 1 FROM D3UB1 GIVING BUB3.
SUBTRACT 1 FROM D3UB1 GIVING BUB4.
SUBTRACT 1 FROM D3UB1 GIVING BUB5.
SUBTRACT 1 FROM D3UB1 GIVING BUB6.
DISPLAY BUB1 BBUB2 BUB3 BUB4 BUB5 BUB6.
SUBTRACT 1 FROM D3UB2 GIVING BBUB2.
SUBTRACT 1 FROM D3UB2 GIVING BUB3.
SUBTRACT 1 FROM D3UB2 GIVING BUB4.
SUBTRACT 1 FROM D3UB2 GIVING BUB5.
SUBTRACT 1 FROM D3UB2 GIVING BUB6.
DISPLAY BBUB2 BUB3 BUB4 BUB5 BUB6.
SUBTRACT 1 FROM D3UB3 GIVING BUB3.
SUBTRACT 1 FROM D3UB3 GIVING BUB4.
SUBTRACT 1 FROM D3UB3 GIVING BUB5.
SUBTRACT 1 FROM D3UB3 GIVING BUB6.
DISPLAY BUB3 BUB4 BUB5 BUB6.
SUBTRACT 1 FROM D3UB4 GIVING BUB4.
SUBTRACT 1 FROM D3UB4 GIVING BUB5.
SUBTRACT 1 FROM D3UB4 GIVING BUB6.
DISPLAY BUB4 BUB5 BUB6.
SUBTRACT 1 FROM D3UB5 GIVING BUB5.
SUBTRACT 1 FROM D3UB5 GIVING BUB6.
DISPLAY BUB5 BUB6.
SUBTRACT 1 FROM D3UB6 GIVING BUB6.
DISPLAY BUB6.
DISPLAY '6 BINARY'.
SUBTRACT 1 FROM DBUB1 GIVING BUB1.
SUBTRACT 1 FROM DBUB1 GIVING BBUB2.
SUBTRACT 1 FROM DBUB1 GIVING BUB3.
SUBTRACT 1 FROM DBUB1 GIVING BUB4.
SUBTRACT 1 FROM DBUB1 GIVING BUB5.
SUBTRACT 1 FROM DBUB1 GIVING BUB6.
DISPLAY BUB1 BBUB2 BUB3 BUB4 BUB5 BUB6.
SUBTRACT 1 FROM DBUB2 GIVING BBUB2.
SUBTRACT 1 FROM DBUB2 GIVING BUB3.
SUBTRACT 1 FROM DBUB2 GIVING BUB4.
SUBTRACT 1 FROM DBUB2 GIVING BUB5.
SUBTRACT 1 FROM DBUB2 GIVING BUB6.
DISPLAY BBUB2 BUB3 BUB4 BUB5 BUB6.
SUBTRACT 1 FROM DBUB3 GIVING BUB3.
SUBTRACT 1 FROM DBUB3 GIVING BUB4.
SUBTRACT 1 FROM DBUB3 GIVING BUB5.
SUBTRACT 1 FROM DBUB3 GIVING BUB6.
DISPLAY BUB3 BUB4 BUB5 BUB6.
SUBTRACT 1 FROM DBUB4 GIVING BUB4.
SUBTRACT 1 FROM DBUB4 GIVING BUB5.
SUBTRACT 1 FROM DBUB4 GIVING BUB6.
DISPLAY BUB4 BUB5 BUB6.
SUBTRACT 1 FROM DBUB5 GIVING BUB5.
SUBTRACT 1 FROM DBUB5 GIVING BUB6.
DISPLAY BUB5 BUB6.
SUBTRACT 1 FROM DBUB6 GIVING BUB6.
DISPLAY BUB6.
DISPLAY 'RECEIVING FIELD COMP'.
DISPLAY '7 DECIMAL'.
SUBTRACT 1 FROM DDUB1 GIVING CUB1.
SUBTRACT 1 FROM DDUB1 GIVING CUB2.
SUBTRACT 1 FROM DDUB1 GIVING CUB3.
SUBTRACT 1 FROM DDUB1 GIVING CUB4.
SUBTRACT 1 FROM DDUB1 GIVING CUB5.
SUBTRACT 1 FROM DDUB1 GIVING CUB6.
DISPLAY CUB1 CUB2 CUB3 CUB4 CUB5 CUB6.
SUBTRACT 1 FROM DDUB2 GIVING CUB2.
SUBTRACT 1 FROM DDUB2 GIVING CUB3.
SUBTRACT 1 FROM DDUB2 GIVING CUB4.
SUBTRACT 1 FROM DDUB2 GIVING CUB5.
SUBTRACT 1 FROM DDUB2 GIVING CUB6.
DISPLAY CUB2 CUB3 CUB4 CUB5 CUB6.
SUBTRACT 1 FROM DDUB3 GIVING CUB3.
SUBTRACT 1 FROM DDUB3 GIVING CUB4.
SUBTRACT 1 FROM DDUB3 GIVING CUB5.
SUBTRACT 1 FROM DDUB3 GIVING CUB6.
DISPLAY CUB3 CUB4 CUB5 CUB6.
SUBTRACT 1 FROM DDUB4 GIVING CUB4.
SUBTRACT 1 FROM DDUB4 GIVING CUB5.
SUBTRACT 1 FROM DDUB4 GIVING CUB6.
DISPLAY CUB4 CUB5 CUB6.
SUBTRACT 1 FROM DDUB5 GIVING CUB5.
SUBTRACT 1 FROM DDUB5 GIVING CUB6.
DISPLAY CUB5 CUB6.
SUBTRACT 1 FROM DDUB6 GIVING CUB6.
DISPLAY CUB6.
DISPLAY '8 COMP-3'.
SUBTRACT 1 FROM D3UB1 GIVING CUB1.
SUBTRACT 1 FROM D3UB1 GIVING CUB2.
SUBTRACT 1 FROM D3UB1 GIVING CUB3.
SUBTRACT 1 FROM D3UB1 GIVING CUB4.
SUBTRACT 1 FROM D3UB1 GIVING CUB5.
SUBTRACT 1 FROM D3UB1 GIVING CUB6.
DISPLAY CUB1 CUB2 CUB3 CUB4 CUB5 CUB6.
SUBTRACT 1 FROM D3UB2 GIVING CUB2.
SUBTRACT 1 FROM D3UB2 GIVING CUB3.
SUBTRACT 1 FROM D3UB2 GIVING CUB4.
SUBTRACT 1 FROM D3UB2 GIVING CUB5.
SUBTRACT 1 FROM D3UB2 GIVING CUB6.
DISPLAY CUB2 CUB3 CUB4 CUB5 CUB6.
SUBTRACT 1 FROM D3UB3 GIVING CUB3.
SUBTRACT 1 FROM D3UB3 GIVING CUB4.
SUBTRACT 1 FROM D3UB3 GIVING CUB5.
SUBTRACT 1 FROM D3UB3 GIVING CUB6.
DISPLAY CUB3 CUB4 CUB5 CUB6.
SUBTRACT 1 FROM D3UB4 GIVING CUB4.
SUBTRACT 1 FROM D3UB4 GIVING CUB5.
SUBTRACT 1 FROM D3UB4 GIVING CUB6.
DISPLAY CUB4 CUB5 CUB6.
SUBTRACT 1 FROM D3UB5 GIVING CUB5.
SUBTRACT 1 FROM D3UB5 GIVING CUB6.
DISPLAY CUB5 CUB6.
SUBTRACT 1 FROM D3UB6 GIVING CUB6.
DISPLAY CUB6.
DISPLAY '9 BINARY'.
SUBTRACT 1 FROM DBUB1 GIVING CUB1.
SUBTRACT 1 FROM DBUB1 GIVING CUB2.
SUBTRACT 1 FROM DBUB1 GIVING CUB3.
SUBTRACT 1 FROM DBUB1 GIVING CUB4.
SUBTRACT 1 FROM DBUB1 GIVING CUB5.
SUBTRACT 1 FROM DBUB1 GIVING CUB6.
DISPLAY CUB1 CUB2 CUB3 CUB4 CUB5 CUB6.
SUBTRACT 1 FROM DBUB2 GIVING CUB2.
SUBTRACT 1 FROM DBUB2 GIVING CUB3.
SUBTRACT 1 FROM DBUB2 GIVING CUB4.
SUBTRACT 1 FROM DBUB2 GIVING CUB5.
SUBTRACT 1 FROM DBUB2 GIVING CUB6.
DISPLAY CUB2 CUB3 CUB4 CUB5 CUB6.
SUBTRACT 1 FROM DBUB3 GIVING CUB3.
SUBTRACT 1 FROM DBUB3 GIVING CUB4.
SUBTRACT 1 FROM DBUB3 GIVING CUB5.
SUBTRACT 1 FROM DBUB3 GIVING CUB6.
DISPLAY CUB3 CUB4 CUB5 CUB6.
SUBTRACT 1 FROM DBUB4 GIVING CUB4.
SUBTRACT 1 FROM DBUB4 GIVING CUB5.
SUBTRACT 1 FROM DBUB4 GIVING CUB6.
DISPLAY CUB4 CUB5 CUB6.
SUBTRACT 1 FROM DBUB5 GIVING CUB5.
SUBTRACT 1 FROM DBUB5 GIVING CUB6.
DISPLAY CUB5 CUB6.
SUBTRACT 1 FROM DBUB6 GIVING CUB6.
DISPLAY CUB6.
DISPLAY 'SUBSTITUTE SUB1 FOR 1'
DISPLAY 'RECEIVING FIELD DECIMAL'.
DISPLAY '10 DECIMAL'.
SUBTRACT SUB1 FROM DDUB1 GIVING AUB1.
SUBTRACT SUB1 FROM DDUB1 GIVING AUB2.
SUBTRACT SUB1 FROM DDUB1 GIVING AUB3.
SUBTRACT SUB1 FROM DDUB1 GIVING AUB4.
SUBTRACT SUB1 FROM DDUB1 GIVING AUB5.
SUBTRACT SUB1 FROM DDUB1 GIVING AUB6.
DISPLAY AUB1 AUB2 AUB3 AUB4 AUB5 AUB6.
SUBTRACT SUB1 FROM DDUB2 GIVING AUB2.
SUBTRACT SUB1 FROM DDUB2 GIVING AUB3.
SUBTRACT SUB1 FROM DDUB2 GIVING AUB4.
SUBTRACT SUB1 FROM DDUB2 GIVING AUB5.
SUBTRACT SUB1 FROM DDUB2 GIVING AUB6.
DISPLAY AUB2 AUB3 AUB4 AUB5 AUB6.
SUBTRACT SUB1 FROM DDUB3 GIVING AUB3.
SUBTRACT SUB1 FROM DDUB3 GIVING AUB4.
SUBTRACT SUB1 FROM DDUB3 GIVING AUB5.
SUBTRACT SUB1 FROM DDUB3 GIVING AUB6.
DISPLAY AUB3 AUB4 AUB5 AUB6.
SUBTRACT SUB1 FROM DDUB4 GIVING AUB4.
SUBTRACT SUB1 FROM DDUB4 GIVING AUB5.
SUBTRACT SUB1 FROM DDUB4 GIVING AUB6.
DISPLAY AUB4 AUB5 AUB6.
SUBTRACT SUB1 FROM DDUB5 GIVING AUB5.
SUBTRACT SUB1 FROM DDUB5 GIVING AUB6.
DISPLAY AUB5 AUB6.
SUBTRACT SUB1 FROM DDUB6 GIVING AUB6.
DISPLAY AUB6.
DISPLAY '11 COMP-3'.
SUBTRACT SUB1 FROM D3UB1 GIVING AUB1.
SUBTRACT SUB1 FROM D3UB1 GIVING AUB2.
SUBTRACT SUB1 FROM D3UB1 GIVING AUB3.
SUBTRACT SUB1 FROM D3UB1 GIVING AUB4.
SUBTRACT SUB1 FROM D3UB1 GIVING AUB5.
SUBTRACT SUB1 FROM D3UB1 GIVING AUB6.
DISPLAY AUB1 AUB2 AUB3 AUB4 AUB5 AUB6.
SUBTRACT SUB1 FROM D3UB2 GIVING AUB2.
SUBTRACT SUB1 FROM D3UB2 GIVING AUB3.
SUBTRACT SUB1 FROM D3UB2 GIVING AUB4.
SUBTRACT SUB1 FROM D3UB2 GIVING AUB5.
SUBTRACT SUB1 FROM D3UB2 GIVING AUB6.
DISPLAY AUB2 AUB3 AUB4 AUB5 AUB6.
SUBTRACT SUB1 FROM D3UB3 GIVING AUB3.
SUBTRACT SUB1 FROM D3UB3 GIVING AUB4.
SUBTRACT SUB1 FROM D3UB3 GIVING AUB5.
SUBTRACT SUB1 FROM D3UB3 GIVING AUB6.
DISPLAY AUB3 AUB4 AUB5 AUB6.
SUBTRACT SUB1 FROM D3UB4 GIVING AUB4.
SUBTRACT SUB1 FROM D3UB4 GIVING AUB5.
SUBTRACT SUB1 FROM D3UB4 GIVING AUB6.
DISPLAY AUB4 AUB5 AUB6.
SUBTRACT SUB1 FROM D3UB5 GIVING AUB5.
SUBTRACT SUB1 FROM D3UB5 GIVING AUB6.
DISPLAY AUB5 AUB6.
SUBTRACT SUB1 FROM D3UB6 GIVING AUB6.
DISPLAY AUB6.
DISPLAY '12 BINARY'.
SUBTRACT SUB1 FROM DBUB1 GIVING AUB1.
SUBTRACT SUB1 FROM DBUB1 GIVING AUB2.
SUBTRACT SUB1 FROM DBUB1 GIVING AUB3.
SUBTRACT SUB1 FROM DBUB1 GIVING AUB4.
SUBTRACT SUB1 FROM DBUB1 GIVING AUB5.
SUBTRACT SUB1 FROM DBUB1 GIVING AUB6.
DISPLAY AUB1 AUB2 AUB3 AUB4 AUB5 AUB6.
SUBTRACT SUB1 FROM DBUB2 GIVING AUB2.
SUBTRACT SUB1 FROM DBUB2 GIVING AUB3.
SUBTRACT SUB1 FROM DBUB2 GIVING AUB4.
SUBTRACT SUB1 FROM DBUB2 GIVING AUB5.
SUBTRACT SUB1 FROM DBUB2 GIVING AUB6.
DISPLAY AUB2 AUB3 AUB4 AUB5 AUB6.
SUBTRACT SUB1 FROM DBUB3 GIVING AUB3.
SUBTRACT SUB1 FROM DBUB3 GIVING AUB4.
SUBTRACT SUB1 FROM DBUB3 GIVING AUB5.
SUBTRACT SUB1 FROM DBUB3 GIVING AUB6.
DISPLAY AUB3 AUB4 AUB5 AUB6.
SUBTRACT SUB1 FROM DBUB4 GIVING AUB4.
SUBTRACT SUB1 FROM DBUB4 GIVING AUB5.
SUBTRACT SUB1 FROM DBUB4 GIVING AUB6.
DISPLAY AUB4 AUB5 AUB6.
SUBTRACT SUB1 FROM DBUB5 GIVING AUB5.
SUBTRACT SUB1 FROM DBUB5 GIVING AUB6.
DISPLAY AUB5 AUB6.
SUBTRACT SUB1 FROM DBUB6 GIVING AUB6.
DISPLAY AUB6.
DISPLAY 'RECEIVING FIELD COMP-3'.
DISPLAY '13 DECIMAL'.
SUBTRACT SUB1 FROM DDUB1 GIVING BUB1.
SUBTRACT SUB1 FROM DDUB1 GIVING BBUB2.
SUBTRACT SUB1 FROM DDUB1 GIVING BUB3.
SUBTRACT SUB1 FROM DDUB1 GIVING BUB4.
SUBTRACT SUB1 FROM DDUB1 GIVING BUB5.
SUBTRACT SUB1 FROM DDUB1 GIVING BUB6.
DISPLAY BUB1 BBUB2 BUB3 BUB4 BUB5 BUB6.
SUBTRACT SUB1 FROM DDUB2 GIVING BBUB2.
SUBTRACT SUB1 FROM DDUB2 GIVING BUB3.
SUBTRACT SUB1 FROM DDUB2 GIVING BUB4.
SUBTRACT SUB1 FROM DDUB2 GIVING BUB5.
SUBTRACT SUB1 FROM DDUB2 GIVING BUB6.
DISPLAY BBUB2 BUB3 BUB4 BUB5 BUB6.
SUBTRACT SUB1 FROM DDUB3 GIVING BUB3.
SUBTRACT SUB1 FROM DDUB3 GIVING BUB4.
SUBTRACT SUB1 FROM DDUB3 GIVING BUB5.
SUBTRACT SUB1 FROM DDUB3 GIVING BUB6.
DISPLAY BUB3 BUB4 BUB5 BUB6.
SUBTRACT SUB1 FROM DDUB4 GIVING BUB4.
SUBTRACT SUB1 FROM DDUB4 GIVING BUB5.
SUBTRACT SUB1 FROM DDUB4 GIVING BUB6.
DISPLAY BUB4 BUB5 BUB6.
SUBTRACT SUB1 FROM DDUB5 GIVING BUB5.
SUBTRACT SUB1 FROM DDUB5 GIVING BUB6.
DISPLAY BUB5 BUB6.
SUBTRACT SUB1 FROM DDUB6 GIVING BUB6.
DISPLAY BUB6.
DISPLAY '14 COMP-3'.
SUBTRACT SUB1 FROM D3UB1 GIVING BUB1.
SUBTRACT SUB1 FROM D3UB1 GIVING BBUB2.
SUBTRACT SUB1 FROM D3UB1 GIVING BUB3.
SUBTRACT SUB1 FROM D3UB1 GIVING BUB4.
SUBTRACT SUB1 FROM D3UB1 GIVING BUB5.
SUBTRACT SUB1 FROM D3UB1 GIVING BUB6.
DISPLAY BUB1 BBUB2 BUB3 BUB4 BUB5 BUB6.
SUBTRACT SUB1 FROM D3UB2 GIVING BBUB2.
SUBTRACT SUB1 FROM D3UB2 GIVING BUB3.
SUBTRACT SUB1 FROM D3UB2 GIVING BUB4.
SUBTRACT SUB1 FROM D3UB2 GIVING BUB5.
SUBTRACT SUB1 FROM D3UB2 GIVING BUB6.
DISPLAY BBUB2 BUB3 BUB4 BUB5 BUB6.
SUBTRACT SUB1 FROM D3UB3 GIVING BUB3.
SUBTRACT SUB1 FROM D3UB3 GIVING BUB4.
SUBTRACT SUB1 FROM D3UB3 GIVING BUB5.
SUBTRACT SUB1 FROM D3UB3 GIVING BUB6.
DISPLAY BUB3 BUB4 BUB5 BUB6.
SUBTRACT SUB1 FROM D3UB4 GIVING BUB4.
SUBTRACT SUB1 FROM D3UB4 GIVING BUB5.
SUBTRACT SUB1 FROM D3UB4 GIVING BUB6.
DISPLAY BUB4 BUB5 BUB6.
SUBTRACT SUB1 FROM D3UB5 GIVING BUB5.
SUBTRACT SUB1 FROM D3UB5 GIVING BUB6.
DISPLAY BUB5 BUB6.
SUBTRACT SUB1 FROM D3UB6 GIVING BUB6.
DISPLAY BUB6.
DISPLAY '15 BINARY'.
SUBTRACT SUB1 FROM DBUB1 GIVING BUB1.
SUBTRACT SUB1 FROM DBUB1 GIVING BBUB2.
SUBTRACT SUB1 FROM DBUB1 GIVING BUB3.
SUBTRACT SUB1 FROM DBUB1 GIVING BUB4.
SUBTRACT SUB1 FROM DBUB1 GIVING BUB5.
SUBTRACT SUB1 FROM DBUB1 GIVING BUB6.
DISPLAY BUB1 BBUB2 BUB3 BUB4 BUB5 BUB6.
SUBTRACT SUB1 FROM DBUB2 GIVING BBUB2.
SUBTRACT SUB1 FROM DBUB2 GIVING BUB3.
SUBTRACT SUB1 FROM DBUB2 GIVING BUB4.
SUBTRACT SUB1 FROM DBUB2 GIVING BUB5.
SUBTRACT SUB1 FROM DBUB2 GIVING BUB6.
DISPLAY BBUB2 BUB3 BUB4 BUB5 BUB6.
SUBTRACT SUB1 FROM DBUB3 GIVING BUB3.
SUBTRACT SUB1 FROM DBUB3 GIVING BUB4.
SUBTRACT SUB1 FROM DBUB3 GIVING BUB5.
SUBTRACT SUB1 FROM DBUB3 GIVING BUB6.
DISPLAY BUB3 BUB4 BUB5 BUB6.
SUBTRACT SUB1 FROM DBUB4 GIVING BUB4.
SUBTRACT SUB1 FROM DBUB4 GIVING BUB5.
SUBTRACT SUB1 FROM DBUB4 GIVING BUB6.
DISPLAY BUB4 BUB5 BUB6.
SUBTRACT SUB1 FROM DBUB5 GIVING BUB5.
SUBTRACT SUB1 FROM DBUB5 GIVING BUB6.
DISPLAY BUB5 BUB6.
SUBTRACT SUB1 FROM DBUB6 GIVING BUB6.
DISPLAY BUB6.
DISPLAY 'RECEIVING FIELD COMP'.
DISPLAY '16 DECIMAL'.
SUBTRACT SUB1 FROM DDUB1 GIVING CUB1.
SUBTRACT SUB1 FROM DDUB1 GIVING CUB2.
SUBTRACT SUB1 FROM DDUB1 GIVING CUB3.
SUBTRACT SUB1 FROM DDUB1 GIVING CUB4.
SUBTRACT SUB1 FROM DDUB1 GIVING CUB5.
SUBTRACT SUB1 FROM DDUB1 GIVING CUB6.
DISPLAY CUB1 CUB2 CUB3 CUB4 CUB5 CUB6.
SUBTRACT SUB1 FROM DDUB2 GIVING CUB2.
SUBTRACT SUB1 FROM DDUB2 GIVING CUB3.
SUBTRACT SUB1 FROM DDUB2 GIVING CUB4.
SUBTRACT SUB1 FROM DDUB2 GIVING CUB5.
SUBTRACT SUB1 FROM DDUB2 GIVING CUB6.
DISPLAY CUB2 CUB3 CUB4 CUB5 CUB6.
SUBTRACT SUB1 FROM DDUB3 GIVING CUB3.
SUBTRACT SUB1 FROM DDUB3 GIVING CUB4.
SUBTRACT SUB1 FROM DDUB3 GIVING CUB5.
SUBTRACT SUB1 FROM DDUB3 GIVING CUB6.
DISPLAY CUB3 CUB4 CUB5 CUB6.
SUBTRACT SUB1 FROM DDUB4 GIVING CUB4.
SUBTRACT SUB1 FROM DDUB4 GIVING CUB5.
SUBTRACT SUB1 FROM DDUB4 GIVING CUB6.
DISPLAY CUB4 CUB5 CUB6.
SUBTRACT SUB1 FROM DDUB5 GIVING CUB5.
SUBTRACT SUB1 FROM DDUB5 GIVING CUB6.
DISPLAY CUB5 CUB6.
SUBTRACT SUB1 FROM DDUB6 GIVING CUB6.
DISPLAY CUB6.
DISPLAY '17 COMP-3'.
SUBTRACT SUB1 FROM D3UB1 GIVING CUB1.
SUBTRACT SUB1 FROM D3UB1 GIVING CUB2.
SUBTRACT SUB1 FROM D3UB1 GIVING CUB3.
SUBTRACT SUB1 FROM D3UB1 GIVING CUB4.
SUBTRACT SUB1 FROM D3UB1 GIVING CUB5.
SUBTRACT SUB1 FROM D3UB1 GIVING CUB6.
DISPLAY CUB1 CUB2 CUB3 CUB4 CUB5 CUB6.
SUBTRACT SUB1 FROM D3UB2 GIVING CUB2.
SUBTRACT SUB1 FROM D3UB2 GIVING CUB3.
SUBTRACT SUB1 FROM D3UB2 GIVING CUB4.
SUBTRACT SUB1 FROM D3UB2 GIVING CUB5.
SUBTRACT SUB1 FROM D3UB2 GIVING CUB6.
DISPLAY CUB2 CUB3 CUB4 CUB5 CUB6.
SUBTRACT SUB1 FROM D3UB3 GIVING CUB3.
SUBTRACT SUB1 FROM D3UB3 GIVING CUB4.
SUBTRACT SUB1 FROM D3UB3 GIVING CUB5.
SUBTRACT SUB1 FROM D3UB3 GIVING CUB6.
DISPLAY CUB3 CUB4 CUB5 CUB6.
SUBTRACT SUB1 FROM D3UB4 GIVING CUB4.
SUBTRACT SUB1 FROM D3UB4 GIVING CUB5.
SUBTRACT SUB1 FROM D3UB4 GIVING CUB6.
DISPLAY CUB4 CUB5 CUB6.
SUBTRACT SUB1 FROM D3UB5 GIVING CUB5.
SUBTRACT SUB1 FROM D3UB5 GIVING CUB6.
DISPLAY CUB5 CUB6.
SUBTRACT SUB1 FROM D3UB6 GIVING CUB6.
DISPLAY CUB6.
DISPLAY '18 BINARY'.
SUBTRACT SUB1 FROM DBUB1 GIVING CUB1.
SUBTRACT SUB1 FROM DBUB1 GIVING CUB2.
SUBTRACT SUB1 FROM DBUB1 GIVING CUB3.
SUBTRACT SUB1 FROM DBUB1 GIVING CUB4.
SUBTRACT SUB1 FROM DBUB1 GIVING CUB5.
SUBTRACT SUB1 FROM DBUB1 GIVING CUB6.
DISPLAY CUB1 CUB2 CUB3 CUB4 CUB5 CUB6.
SUBTRACT SUB1 FROM DBUB2 GIVING CUB2.
SUBTRACT SUB1 FROM DBUB2 GIVING CUB3.
SUBTRACT SUB1 FROM DBUB2 GIVING CUB4.
SUBTRACT SUB1 FROM DBUB2 GIVING CUB5.
SUBTRACT SUB1 FROM DBUB2 GIVING CUB6.
DISPLAY CUB2 CUB3 CUB4 CUB5 CUB6.
SUBTRACT SUB1 FROM DBUB3 GIVING CUB3.
SUBTRACT SUB1 FROM DBUB3 GIVING CUB4.
SUBTRACT SUB1 FROM DBUB3 GIVING CUB5.
SUBTRACT SUB1 FROM DBUB3 GIVING CUB6.
DISPLAY CUB3 CUB4 CUB5 CUB6.
SUBTRACT SUB1 FROM DBUB4 GIVING CUB4.
SUBTRACT SUB1 FROM DBUB4 GIVING CUB5.
SUBTRACT SUB1 FROM DBUB4 GIVING CUB6.
DISPLAY CUB4 CUB5 CUB6.
SUBTRACT SUB1 FROM DBUB5 GIVING CUB5.
SUBTRACT SUB1 FROM DBUB5 GIVING CUB6.
DISPLAY CUB5 CUB6.
SUBTRACT SUB1 FROM DBUB6 GIVING CUB6.
DISPLAY CUB6.
DISPLAY 'SUBSTITUTE SUB3 FOR 1'
DISPLAY 'RECEIVING FIELD DECIMAL'.
DISPLAY '19 DECIMAL'.
SUBTRACT SUB3 FROM DDUB1 GIVING AUB1.
SUBTRACT SUB3 FROM DDUB1 GIVING AUB2.
SUBTRACT SUB3 FROM DDUB1 GIVING AUB3.
SUBTRACT SUB3 FROM DDUB1 GIVING AUB4.
SUBTRACT SUB3 FROM DDUB1 GIVING AUB5.
SUBTRACT SUB3 FROM DDUB1 GIVING AUB6.
DISPLAY AUB1 AUB2 AUB3 AUB4 AUB5 AUB6.
SUBTRACT SUB3 FROM DDUB2 GIVING AUB2.
SUBTRACT SUB3 FROM DDUB2 GIVING AUB3.
SUBTRACT SUB3 FROM DDUB2 GIVING AUB4.
SUBTRACT SUB3 FROM DDUB2 GIVING AUB5.
SUBTRACT SUB3 FROM DDUB2 GIVING AUB6.
DISPLAY AUB2 AUB3 AUB4 AUB5 AUB6.
SUBTRACT SUB3 FROM DDUB3 GIVING AUB3.
SUBTRACT SUB3 FROM DDUB3 GIVING AUB4.
SUBTRACT SUB3 FROM DDUB3 GIVING AUB5.
SUBTRACT SUB3 FROM DDUB3 GIVING AUB6.
DISPLAY AUB3 AUB4 AUB5 AUB6.
SUBTRACT SUB3 FROM DDUB4 GIVING AUB4.
SUBTRACT SUB3 FROM DDUB4 GIVING AUB5.
SUBTRACT SUB3 FROM DDUB4 GIVING AUB6.
DISPLAY AUB4 AUB5 AUB6.
SUBTRACT SUB3 FROM DDUB5 GIVING AUB5.
SUBTRACT SUB3 FROM DDUB5 GIVING AUB6.
DISPLAY AUB5 AUB6.
SUBTRACT SUB3 FROM DDUB6 GIVING AUB6.
DISPLAY AUB6.
DISPLAY '20 COMP-3'.
SUBTRACT SUB3 FROM D3UB1 GIVING AUB1.
SUBTRACT SUB3 FROM D3UB1 GIVING AUB2.
SUBTRACT SUB3 FROM D3UB1 GIVING AUB3.
SUBTRACT SUB3 FROM D3UB1 GIVING AUB4.
SUBTRACT SUB3 FROM D3UB1 GIVING AUB5.
SUBTRACT SUB3 FROM D3UB1 GIVING AUB6.
DISPLAY AUB1 AUB2 AUB3 AUB4 AUB5 AUB6.
SUBTRACT SUB3 FROM D3UB2 GIVING AUB2.
SUBTRACT SUB3 FROM D3UB2 GIVING AUB3.
SUBTRACT SUB3 FROM D3UB2 GIVING AUB4.
SUBTRACT SUB3 FROM D3UB2 GIVING AUB5.
SUBTRACT SUB3 FROM D3UB2 GIVING AUB6.
DISPLAY AUB2 AUB3 AUB4 AUB5 AUB6.
SUBTRACT SUB3 FROM D3UB3 GIVING AUB3.
SUBTRACT SUB3 FROM D3UB3 GIVING AUB4.
SUBTRACT SUB3 FROM D3UB3 GIVING AUB5.
SUBTRACT SUB3 FROM D3UB3 GIVING AUB6.
DISPLAY AUB3 AUB4 AUB5 AUB6.
SUBTRACT SUB3 FROM D3UB4 GIVING AUB4.
SUBTRACT SUB3 FROM D3UB4 GIVING AUB5.
SUBTRACT SUB3 FROM D3UB4 GIVING AUB6.
DISPLAY AUB4 AUB5 AUB6.
SUBTRACT SUB3 FROM D3UB5 GIVING AUB5.
SUBTRACT SUB3 FROM D3UB5 GIVING AUB6.
DISPLAY AUB5 AUB6.
SUBTRACT SUB3 FROM D3UB6 GIVING AUB6.
DISPLAY AUB6.
DISPLAY '21 BINARY'.
SUBTRACT SUB3 FROM DBUB1 GIVING AUB1.
SUBTRACT SUB3 FROM DBUB1 GIVING AUB2.
SUBTRACT SUB3 FROM DBUB1 GIVING AUB3.
SUBTRACT SUB3 FROM DBUB1 GIVING AUB4.
SUBTRACT SUB3 FROM DBUB1 GIVING AUB5.
SUBTRACT SUB3 FROM DBUB1 GIVING AUB6.
DISPLAY AUB1 AUB2 AUB3 AUB4 AUB5 AUB6.
SUBTRACT SUB3 FROM DBUB2 GIVING AUB2.
SUBTRACT SUB3 FROM DBUB2 GIVING AUB3.
SUBTRACT SUB3 FROM DBUB2 GIVING AUB4.
SUBTRACT SUB3 FROM DBUB2 GIVING AUB5.
SUBTRACT SUB3 FROM DBUB2 GIVING AUB6.
DISPLAY AUB2 AUB3 AUB4 AUB5 AUB6.
SUBTRACT SUB3 FROM DBUB3 GIVING AUB3.
SUBTRACT SUB3 FROM DBUB3 GIVING AUB4.
SUBTRACT SUB3 FROM DBUB3 GIVING AUB5.
SUBTRACT SUB3 FROM DBUB3 GIVING AUB6.
DISPLAY AUB3 AUB4 AUB5 AUB6.
SUBTRACT SUB3 FROM DBUB4 GIVING AUB4.
SUBTRACT SUB3 FROM DBUB4 GIVING AUB5.
SUBTRACT SUB3 FROM DBUB4 GIVING AUB6.
DISPLAY AUB4 AUB5 AUB6.
SUBTRACT SUB3 FROM DBUB5 GIVING AUB5.
SUBTRACT SUB3 FROM DBUB5 GIVING AUB6.
DISPLAY AUB5 AUB6.
SUBTRACT SUB3 FROM DBUB6 GIVING AUB6.
DISPLAY AUB6.
DISPLAY 'RECEIVING FIELD COMP-3'.
DISPLAY '22 DECIMAL'.
SUBTRACT SUB3 FROM DDUB1 GIVING BUB1.
SUBTRACT SUB3 FROM DDUB1 GIVING BBUB2.
SUBTRACT SUB3 FROM DDUB1 GIVING BUB3.
SUBTRACT SUB3 FROM DDUB1 GIVING BUB4.
SUBTRACT SUB3 FROM DDUB1 GIVING BUB5.
SUBTRACT SUB3 FROM DDUB1 GIVING BUB6.
DISPLAY BUB1 BBUB2 BUB3 BUB4 BUB5 BUB6.
SUBTRACT SUB3 FROM DDUB2 GIVING BBUB2.
SUBTRACT SUB3 FROM DDUB2 GIVING BUB3.
SUBTRACT SUB3 FROM DDUB2 GIVING BUB4.
SUBTRACT SUB3 FROM DDUB2 GIVING BUB5.
SUBTRACT SUB3 FROM DDUB2 GIVING BUB6.
DISPLAY BBUB2 BUB3 BUB4 BUB5 BUB6.
SUBTRACT SUB3 FROM DDUB3 GIVING BUB3.
SUBTRACT SUB3 FROM DDUB3 GIVING BUB4.
SUBTRACT SUB3 FROM DDUB3 GIVING BUB5.
SUBTRACT SUB3 FROM DDUB3 GIVING BUB6.
DISPLAY BUB3 BUB4 BUB5 BUB6.
SUBTRACT SUB3 FROM DDUB4 GIVING BUB4.
SUBTRACT SUB3 FROM DDUB4 GIVING BUB5.
SUBTRACT SUB3 FROM DDUB4 GIVING BUB6.
DISPLAY BUB4 BUB5 BUB6.
SUBTRACT SUB3 FROM DDUB5 GIVING BUB5.
SUBTRACT SUB3 FROM DDUB5 GIVING BUB6.
DISPLAY BUB5 BUB6.
SUBTRACT SUB3 FROM DDUB6 GIVING BUB6.
DISPLAY BUB6.
DISPLAY '23 COMP-3'.
SUBTRACT SUB3 FROM D3UB1 GIVING BUB1.
SUBTRACT SUB3 FROM D3UB1 GIVING BBUB2.
SUBTRACT SUB3 FROM D3UB1 GIVING BUB3.
SUBTRACT SUB3 FROM D3UB1 GIVING BUB4.
SUBTRACT SUB3 FROM D3UB1 GIVING BUB5.
SUBTRACT SUB3 FROM D3UB1 GIVING BUB6.
DISPLAY BUB1 BBUB2 BUB3 BUB4 BUB5 BUB6.
SUBTRACT SUB3 FROM D3UB2 GIVING BBUB2.
SUBTRACT SUB3 FROM D3UB2 GIVING BUB3.
SUBTRACT SUB3 FROM D3UB2 GIVING BUB4.
SUBTRACT SUB3 FROM D3UB2 GIVING BUB5.
SUBTRACT SUB3 FROM D3UB2 GIVING BUB6.
DISPLAY BBUB2 BUB3 BUB4 BUB5 BUB6.
SUBTRACT SUB3 FROM D3UB3 GIVING BUB3.
SUBTRACT SUB3 FROM D3UB3 GIVING BUB4.
SUBTRACT SUB3 FROM D3UB3 GIVING BUB5.
SUBTRACT SUB3 FROM D3UB3 GIVING BUB6.
DISPLAY BUB3 BUB4 BUB5 BUB6.
SUBTRACT SUB3 FROM D3UB4 GIVING BUB4.
SUBTRACT SUB3 FROM D3UB4 GIVING BUB5.
SUBTRACT SUB3 FROM D3UB4 GIVING BUB6.
DISPLAY BUB4 BUB5 BUB6.
SUBTRACT SUB3 FROM D3UB5 GIVING BUB5.
SUBTRACT SUB3 FROM D3UB5 GIVING BUB6.
DISPLAY BUB5 BUB6.
SUBTRACT SUB3 FROM D3UB6 GIVING BUB6.
DISPLAY BUB6.
DISPLAY '24 BINARY'.
SUBTRACT SUB3 FROM DBUB1 GIVING BUB1.
SUBTRACT SUB3 FROM DBUB1 GIVING BBUB2.
SUBTRACT SUB3 FROM DBUB1 GIVING BUB3.
SUBTRACT SUB3 FROM DBUB1 GIVING BUB4.
SUBTRACT SUB3 FROM DBUB1 GIVING BUB5.
SUBTRACT SUB3 FROM DBUB1 GIVING BUB6.
DISPLAY BUB1 BBUB2 BUB3 BUB4 BUB5 BUB6.
SUBTRACT SUB3 FROM DBUB2 GIVING BBUB2.
SUBTRACT SUB3 FROM DBUB2 GIVING BUB3.
SUBTRACT SUB3 FROM DBUB2 GIVING BUB4.
SUBTRACT SUB3 FROM DBUB2 GIVING BUB5.
SUBTRACT SUB3 FROM DBUB2 GIVING BUB6.
DISPLAY BBUB2 BUB3 BUB4 BUB5 BUB6.
SUBTRACT SUB3 FROM DBUB3 GIVING BUB3.
SUBTRACT SUB3 FROM DBUB3 GIVING BUB4.
SUBTRACT SUB3 FROM DBUB3 GIVING BUB5.
SUBTRACT SUB3 FROM DBUB3 GIVING BUB6.
DISPLAY BUB3 BUB4 BUB5 BUB6.
SUBTRACT SUB3 FROM DBUB4 GIVING BUB4.
SUBTRACT SUB3 FROM DBUB4 GIVING BUB5.
SUBTRACT SUB3 FROM DBUB4 GIVING BUB6.
DISPLAY BUB4 BUB5 BUB6.
SUBTRACT SUB3 FROM DBUB5 GIVING BUB5.
SUBTRACT SUB3 FROM DBUB5 GIVING BUB6.
DISPLAY BUB5 BUB6.
SUBTRACT SUB3 FROM DBUB6 GIVING BUB6.
DISPLAY BUB6.
DISPLAY 'RECEIVING FIELD COMP'.
DISPLAY '25 DECIMAL'.
SUBTRACT SUB3 FROM DDUB1 GIVING CUB1.
SUBTRACT SUB3 FROM DDUB1 GIVING CUB2.
SUBTRACT SUB3 FROM DDUB1 GIVING CUB3.
SUBTRACT SUB3 FROM DDUB1 GIVING CUB4.
SUBTRACT SUB3 FROM DDUB1 GIVING CUB5.
SUBTRACT SUB3 FROM DDUB1 GIVING CUB6.
DISPLAY CUB1 CUB2 CUB3 CUB4 CUB5 CUB6.
SUBTRACT SUB3 FROM DDUB2 GIVING CUB2.
SUBTRACT SUB3 FROM DDUB2 GIVING CUB3.
SUBTRACT SUB3 FROM DDUB2 GIVING CUB4.
SUBTRACT SUB3 FROM DDUB2 GIVING CUB5.
SUBTRACT SUB3 FROM DDUB2 GIVING CUB6.
DISPLAY CUB2 CUB3 CUB4 CUB5 CUB6.
SUBTRACT SUB3 FROM DDUB3 GIVING CUB3.
SUBTRACT SUB3 FROM DDUB3 GIVING CUB4.
SUBTRACT SUB3 FROM DDUB3 GIVING CUB5.
SUBTRACT SUB3 FROM DDUB3 GIVING CUB6.
DISPLAY CUB3 CUB4 CUB5 CUB6.
SUBTRACT SUB3 FROM DDUB4 GIVING CUB4.
SUBTRACT SUB3 FROM DDUB4 GIVING CUB5.
SUBTRACT SUB3 FROM DDUB4 GIVING CUB6.
DISPLAY CUB4 CUB5 CUB6.
SUBTRACT SUB3 FROM DDUB5 GIVING CUB5.
SUBTRACT SUB3 FROM DDUB5 GIVING CUB6.
DISPLAY CUB5 CUB6.
SUBTRACT SUB3 FROM DDUB6 GIVING CUB6.
DISPLAY CUB6.
DISPLAY '26 COMP-3'.
SUBTRACT SUB3 FROM D3UB1 GIVING CUB1.
SUBTRACT SUB3 FROM D3UB1 GIVING CUB2.
SUBTRACT SUB3 FROM D3UB1 GIVING CUB3.
SUBTRACT SUB3 FROM D3UB1 GIVING CUB4.
SUBTRACT SUB3 FROM D3UB1 GIVING CUB5.
SUBTRACT SUB3 FROM D3UB1 GIVING CUB6.
DISPLAY CUB1 CUB2 CUB3 CUB4 CUB5 CUB6.
SUBTRACT SUB3 FROM D3UB2 GIVING CUB2.
SUBTRACT SUB3 FROM D3UB2 GIVING CUB3.
SUBTRACT SUB3 FROM D3UB2 GIVING CUB4.
SUBTRACT SUB3 FROM D3UB2 GIVING CUB5.
SUBTRACT SUB3 FROM D3UB2 GIVING CUB6.
DISPLAY CUB2 CUB3 CUB4 CUB5 CUB6.
SUBTRACT SUB3 FROM D3UB3 GIVING CUB3.
SUBTRACT SUB3 FROM D3UB3 GIVING CUB4.
SUBTRACT SUB3 FROM D3UB3 GIVING CUB5.
SUBTRACT SUB3 FROM D3UB3 GIVING CUB6.
DISPLAY CUB3 CUB4 CUB5 CUB6.
SUBTRACT SUB3 FROM D3UB4 GIVING CUB4.
SUBTRACT SUB3 FROM D3UB4 GIVING CUB5.
SUBTRACT SUB3 FROM D3UB4 GIVING CUB6.
DISPLAY CUB4 CUB5 CUB6.
SUBTRACT SUB3 FROM D3UB5 GIVING CUB5.
SUBTRACT SUB3 FROM D3UB5 GIVING CUB6.
DISPLAY CUB5 CUB6.
SUBTRACT SUB3 FROM D3UB6 GIVING CUB6.
DISPLAY CUB6.
DISPLAY '27 BINARY'.
SUBTRACT SUB3 FROM DBUB1 GIVING CUB1.
SUBTRACT SUB3 FROM DBUB1 GIVING CUB2.
SUBTRACT SUB3 FROM DBUB1 GIVING CUB3.
SUBTRACT SUB3 FROM DBUB1 GIVING CUB4.
SUBTRACT SUB3 FROM DBUB1 GIVING CUB5.
SUBTRACT SUB3 FROM DBUB1 GIVING CUB6.
DISPLAY CUB1 CUB2 CUB3 CUB4 CUB5 CUB6.
SUBTRACT SUB3 FROM DBUB2 GIVING CUB2.
SUBTRACT SUB3 FROM DBUB2 GIVING CUB3.
SUBTRACT SUB3 FROM DBUB2 GIVING CUB4.
SUBTRACT SUB3 FROM DBUB2 GIVING CUB5.
SUBTRACT SUB3 FROM DBUB2 GIVING CUB6.
DISPLAY CUB2 CUB3 CUB4 CUB5 CUB6.
SUBTRACT SUB3 FROM DBUB3 GIVING CUB3.
SUBTRACT SUB3 FROM DBUB3 GIVING CUB4.
SUBTRACT SUB3 FROM DBUB3 GIVING CUB5.
SUBTRACT SUB3 FROM DBUB3 GIVING CUB6.
DISPLAY CUB3 CUB4 CUB5 CUB6.
SUBTRACT SUB3 FROM DBUB4 GIVING CUB4.
SUBTRACT SUB3 FROM DBUB4 GIVING CUB5.
SUBTRACT SUB3 FROM DBUB4 GIVING CUB6.
DISPLAY CUB4 CUB5 CUB6.
SUBTRACT SUB3 FROM DBUB5 GIVING CUB5.
SUBTRACT SUB3 FROM DBUB5 GIVING CUB6.
DISPLAY CUB5 CUB6.
SUBTRACT SUB3 FROM DBUB6 GIVING CUB6.
DISPLAY CUB6.
DISPLAY 'SUBSTITUTE SUB2 FOR 1'
DISPLAY 'RECEIVING FIELD DECIMAL'.
DISPLAY '28 DECIMAL'.
SUBTRACT SUB2 FROM DDUB1 GIVING AUB1.
SUBTRACT SUB2 FROM DDUB1 GIVING AUB2.
SUBTRACT SUB2 FROM DDUB1 GIVING AUB3.
SUBTRACT SUB2 FROM DDUB1 GIVING AUB4.
SUBTRACT SUB2 FROM DDUB1 GIVING AUB5.
SUBTRACT SUB2 FROM DDUB1 GIVING AUB6.
DISPLAY AUB1 AUB2 AUB3 AUB4 AUB5 AUB6.
SUBTRACT SUB2 FROM DDUB2 GIVING AUB2.
SUBTRACT SUB2 FROM DDUB2 GIVING AUB3.
SUBTRACT SUB2 FROM DDUB2 GIVING AUB4.
SUBTRACT SUB2 FROM DDUB2 GIVING AUB5.
SUBTRACT SUB2 FROM DDUB2 GIVING AUB6.
DISPLAY AUB2 AUB3 AUB4 AUB5 AUB6.
SUBTRACT SUB2 FROM DDUB3 GIVING AUB3.
SUBTRACT SUB2 FROM DDUB3 GIVING AUB4.
SUBTRACT SUB2 FROM DDUB3 GIVING AUB5.
SUBTRACT SUB2 FROM DDUB3 GIVING AUB6.
DISPLAY AUB3 AUB4 AUB5 AUB6.
SUBTRACT SUB2 FROM DDUB4 GIVING AUB4.
SUBTRACT SUB2 FROM DDUB4 GIVING AUB5.
SUBTRACT SUB2 FROM DDUB4 GIVING AUB6.
DISPLAY AUB4 AUB5 AUB6.
SUBTRACT SUB2 FROM DDUB5 GIVING AUB5.
SUBTRACT SUB2 FROM DDUB5 GIVING AUB6.
DISPLAY AUB5 AUB6.
SUBTRACT SUB2 FROM DDUB6 GIVING AUB6.
DISPLAY AUB6.
DISPLAY '29 COMP-3'.
SUBTRACT SUB2 FROM D3UB1 GIVING AUB1.
SUBTRACT SUB2 FROM D3UB1 GIVING AUB2.
SUBTRACT SUB2 FROM D3UB1 GIVING AUB3.
SUBTRACT SUB2 FROM D3UB1 GIVING AUB4.
SUBTRACT SUB2 FROM D3UB1 GIVING AUB5.
SUBTRACT SUB2 FROM D3UB1 GIVING AUB6.
DISPLAY AUB1 AUB2 AUB3 AUB4 AUB5 AUB6.
SUBTRACT SUB2 FROM D3UB2 GIVING AUB2.
SUBTRACT SUB2 FROM D3UB2 GIVING AUB3.
SUBTRACT SUB2 FROM D3UB2 GIVING AUB4.
SUBTRACT SUB2 FROM D3UB2 GIVING AUB5.
SUBTRACT SUB2 FROM D3UB2 GIVING AUB6.
DISPLAY AUB2 AUB3 AUB4 AUB5 AUB6.
SUBTRACT SUB2 FROM D3UB3 GIVING AUB3.
SUBTRACT SUB2 FROM D3UB3 GIVING AUB4.
SUBTRACT SUB2 FROM D3UB3 GIVING AUB5.
SUBTRACT SUB2 FROM D3UB3 GIVING AUB6.
DISPLAY AUB3 AUB4 AUB5 AUB6.
SUBTRACT SUB2 FROM D3UB4 GIVING AUB4.
SUBTRACT SUB2 FROM D3UB4 GIVING AUB5.
SUBTRACT SUB2 FROM D3UB4 GIVING AUB6.
DISPLAY AUB4 AUB5 AUB6.
SUBTRACT SUB2 FROM D3UB5 GIVING AUB5.
SUBTRACT SUB2 FROM D3UB5 GIVING AUB6.
DISPLAY AUB5 AUB6.
SUBTRACT SUB2 FROM D3UB6 GIVING AUB6.
DISPLAY AUB6.
DISPLAY '30 BINARY'.
SUBTRACT SUB2 FROM DBUB1 GIVING AUB1.
SUBTRACT SUB2 FROM DBUB1 GIVING AUB2.
SUBTRACT SUB2 FROM DBUB1 GIVING AUB3.
SUBTRACT SUB2 FROM DBUB1 GIVING AUB4.
SUBTRACT SUB2 FROM DBUB1 GIVING AUB5.
SUBTRACT SUB2 FROM DBUB1 GIVING AUB6.
DISPLAY AUB1 AUB2 AUB3 AUB4 AUB5 AUB6.
SUBTRACT SUB2 FROM DBUB2 GIVING AUB2.
SUBTRACT SUB2 FROM DBUB2 GIVING AUB3.
SUBTRACT SUB2 FROM DBUB2 GIVING AUB4.
SUBTRACT SUB2 FROM DBUB2 GIVING AUB5.
SUBTRACT SUB2 FROM DBUB2 GIVING AUB6.
DISPLAY AUB2 AUB3 AUB4 AUB5 AUB6.
SUBTRACT SUB2 FROM DBUB3 GIVING AUB3.
SUBTRACT SUB2 FROM DBUB3 GIVING AUB4.
SUBTRACT SUB2 FROM DBUB3 GIVING AUB5.
SUBTRACT SUB2 FROM DBUB3 GIVING AUB6.
DISPLAY AUB3 AUB4 AUB5 AUB6.
SUBTRACT SUB2 FROM DBUB4 GIVING AUB4.
SUBTRACT SUB2 FROM DBUB4 GIVING AUB5.
SUBTRACT SUB2 FROM DBUB4 GIVING AUB6.
DISPLAY AUB4 AUB5 AUB6.
SUBTRACT SUB2 FROM DBUB5 GIVING AUB5.
SUBTRACT SUB2 FROM DBUB5 GIVING AUB6.
DISPLAY AUB5 AUB6.
SUBTRACT SUB2 FROM DBUB6 GIVING AUB6.
DISPLAY AUB6.
DISPLAY 'RECEIVING FIELD COMP-3'.
DISPLAY '31 DECIMAL'.
SUBTRACT SUB2 FROM DDUB1 GIVING BUB1.
SUBTRACT SUB2 FROM DDUB1 GIVING BBUB2.
SUBTRACT SUB2 FROM DDUB1 GIVING BUB3.
SUBTRACT SUB2 FROM DDUB1 GIVING BUB4.
SUBTRACT SUB2 FROM DDUB1 GIVING BUB5.
SUBTRACT SUB2 FROM DDUB1 GIVING BUB6.
DISPLAY BUB1 BBUB2 BUB3 BUB4 BUB5 BUB6.
SUBTRACT SUB2 FROM DDUB2 GIVING BBUB2.
SUBTRACT SUB2 FROM DDUB2 GIVING BUB3.
SUBTRACT SUB2 FROM DDUB2 GIVING BUB4.
SUBTRACT SUB2 FROM DDUB2 GIVING BUB5.
SUBTRACT SUB2 FROM DDUB2 GIVING BUB6.
DISPLAY BBUB2 BUB3 BUB4 BUB5 BUB6.
SUBTRACT SUB2 FROM DDUB3 GIVING BUB3.
SUBTRACT SUB2 FROM DDUB3 GIVING BUB4.
SUBTRACT SUB2 FROM DDUB3 GIVING BUB5.
SUBTRACT SUB2 FROM DDUB3 GIVING BUB6.
DISPLAY BUB3 BUB4 BUB5 BUB6.
SUBTRACT SUB2 FROM DDUB4 GIVING BUB4.
SUBTRACT SUB2 FROM DDUB4 GIVING BUB5.
SUBTRACT SUB2 FROM DDUB4 GIVING BUB6.
DISPLAY BUB4 BUB5 BUB6.
SUBTRACT SUB2 FROM DDUB5 GIVING BUB5.
SUBTRACT SUB2 FROM DDUB5 GIVING BUB6.
DISPLAY BUB5 BUB6.
SUBTRACT SUB2 FROM DDUB6 GIVING BUB6.
DISPLAY BUB6.
DISPLAY '32 COMP-3'.
SUBTRACT SUB2 FROM D3UB1 GIVING BUB1.
SUBTRACT SUB2 FROM D3UB1 GIVING BBUB2.
SUBTRACT SUB2 FROM D3UB1 GIVING BUB3.
SUBTRACT SUB2 FROM D3UB1 GIVING BUB4.
SUBTRACT SUB2 FROM D3UB1 GIVING BUB5.
SUBTRACT SUB2 FROM D3UB1 GIVING BUB6.
DISPLAY BUB1 BBUB2 BUB3 BUB4 BUB5 BUB6.
SUBTRACT SUB2 FROM D3UB2 GIVING BBUB2.
SUBTRACT SUB2 FROM D3UB2 GIVING BUB3.
SUBTRACT SUB2 FROM D3UB2 GIVING BUB4.
SUBTRACT SUB2 FROM D3UB2 GIVING BUB5.
SUBTRACT SUB2 FROM D3UB2 GIVING BUB6.
DISPLAY BBUB2 BUB3 BUB4 BUB5 BUB6.
SUBTRACT SUB2 FROM D3UB3 GIVING BUB3.
SUBTRACT SUB2 FROM D3UB3 GIVING BUB4.
SUBTRACT SUB2 FROM D3UB3 GIVING BUB5.
SUBTRACT SUB2 FROM D3UB3 GIVING BUB6.
DISPLAY BUB3 BUB4 BUB5 BUB6.
SUBTRACT SUB2 FROM D3UB4 GIVING BUB4.
SUBTRACT SUB2 FROM D3UB4 GIVING BUB5.
SUBTRACT SUB2 FROM D3UB4 GIVING BUB6.
DISPLAY BUB4 BUB5 BUB6.
SUBTRACT SUB2 FROM D3UB5 GIVING BUB5.
SUBTRACT SUB2 FROM D3UB5 GIVING BUB6.
DISPLAY BUB5 BUB6.
SUBTRACT SUB2 FROM D3UB6 GIVING BUB6.
DISPLAY BUB6.
DISPLAY '33 BINARY'.
SUBTRACT SUB2 FROM DBUB1 GIVING BUB1.
SUBTRACT SUB2 FROM DBUB1 GIVING BBUB2.
SUBTRACT SUB2 FROM DBUB1 GIVING BUB3.
SUBTRACT SUB2 FROM DBUB1 GIVING BUB4.
SUBTRACT SUB2 FROM DBUB1 GIVING BUB5.
SUBTRACT SUB2 FROM DBUB1 GIVING BUB6.
DISPLAY BUB1 BBUB2 BUB3 BUB4 BUB5 BUB6.
SUBTRACT SUB2 FROM DBUB2 GIVING BBUB2.
SUBTRACT SUB2 FROM DBUB2 GIVING BUB3.
SUBTRACT SUB2 FROM DBUB2 GIVING BUB4.
SUBTRACT SUB2 FROM DBUB2 GIVING BUB5.
SUBTRACT SUB2 FROM DBUB2 GIVING BUB6.
DISPLAY BBUB2 BUB3 BUB4 BUB5 BUB6.
SUBTRACT SUB2 FROM DBUB3 GIVING BUB3.
SUBTRACT SUB2 FROM DBUB3 GIVING BUB4.
SUBTRACT SUB2 FROM DBUB3 GIVING BUB5.
SUBTRACT SUB2 FROM DBUB3 GIVING BUB6.
DISPLAY BUB3 BUB4 BUB5 BUB6.
SUBTRACT SUB2 FROM DBUB4 GIVING BUB4.
SUBTRACT SUB2 FROM DBUB4 GIVING BUB5.
SUBTRACT SUB2 FROM DBUB4 GIVING BUB6.
DISPLAY BUB4 BUB5 BUB6.
SUBTRACT SUB2 FROM DBUB5 GIVING BUB5.
SUBTRACT SUB2 FROM DBUB5 GIVING BUB6.
DISPLAY BUB5 BUB6.
SUBTRACT SUB2 FROM DBUB6 GIVING BUB6.
DISPLAY BUB6.
DISPLAY 'RECEIVING FIELD COMP'.
DISPLAY '34 DECIMAL'.
SUBTRACT SUB2 FROM DDUB1 GIVING CUB1.
SUBTRACT SUB2 FROM DDUB1 GIVING CUB2.
SUBTRACT SUB2 FROM DDUB1 GIVING CUB3.
SUBTRACT SUB2 FROM DDUB1 GIVING CUB4.
SUBTRACT SUB2 FROM DDUB1 GIVING CUB5.
SUBTRACT SUB2 FROM DDUB1 GIVING CUB6.
DISPLAY CUB1 CUB2 CUB3 CUB4 CUB5 CUB6.
SUBTRACT SUB2 FROM DDUB2 GIVING CUB2.
SUBTRACT SUB2 FROM DDUB2 GIVING CUB3.
SUBTRACT SUB2 FROM DDUB2 GIVING CUB4.
SUBTRACT SUB2 FROM DDUB2 GIVING CUB5.
SUBTRACT SUB2 FROM DDUB2 GIVING CUB6.
DISPLAY CUB2 CUB3 CUB4 CUB5 CUB6.
SUBTRACT SUB2 FROM DDUB3 GIVING CUB3.
SUBTRACT SUB2 FROM DDUB3 GIVING CUB4.
SUBTRACT SUB2 FROM DDUB3 GIVING CUB5.
SUBTRACT SUB2 FROM DDUB3 GIVING CUB6.
DISPLAY CUB3 CUB4 CUB5 CUB6.
SUBTRACT SUB2 FROM DDUB4 GIVING CUB4.
SUBTRACT SUB2 FROM DDUB4 GIVING CUB5.
SUBTRACT SUB2 FROM DDUB4 GIVING CUB6.
DISPLAY CUB4 CUB5 CUB6.
SUBTRACT SUB2 FROM DDUB5 GIVING CUB5.
SUBTRACT SUB2 FROM DDUB5 GIVING CUB6.
DISPLAY CUB5 CUB6.
SUBTRACT SUB2 FROM DDUB6 GIVING CUB6.
DISPLAY CUB6.
DISPLAY '35 COMP-3'.
SUBTRACT SUB2 FROM D3UB1 GIVING CUB1.
SUBTRACT SUB2 FROM D3UB1 GIVING CUB2.
SUBTRACT SUB2 FROM D3UB1 GIVING CUB3.
SUBTRACT SUB2 FROM D3UB1 GIVING CUB4.
SUBTRACT SUB2 FROM D3UB1 GIVING CUB5.
SUBTRACT SUB2 FROM D3UB1 GIVING CUB6.
DISPLAY CUB1 CUB2 CUB3 CUB4 CUB5 CUB6.
SUBTRACT SUB2 FROM D3UB2 GIVING CUB2.
SUBTRACT SUB2 FROM D3UB2 GIVING CUB3.
SUBTRACT SUB2 FROM D3UB2 GIVING CUB4.
SUBTRACT SUB2 FROM D3UB2 GIVING CUB5.
SUBTRACT SUB2 FROM D3UB2 GIVING CUB6.
DISPLAY CUB2 CUB3 CUB4 CUB5 CUB6.
SUBTRACT SUB2 FROM D3UB3 GIVING CUB3.
SUBTRACT SUB2 FROM D3UB3 GIVING CUB4.
SUBTRACT SUB2 FROM D3UB3 GIVING CUB5.
SUBTRACT SUB2 FROM D3UB3 GIVING CUB6.
DISPLAY CUB3 CUB4 CUB5 CUB6.
SUBTRACT SUB2 FROM D3UB4 GIVING CUB4.
SUBTRACT SUB2 FROM D3UB4 GIVING CUB5.
SUBTRACT SUB2 FROM D3UB4 GIVING CUB6.
DISPLAY CUB4 CUB5 CUB6.
SUBTRACT SUB2 FROM D3UB5 GIVING CUB5.
SUBTRACT SUB2 FROM D3UB5 GIVING CUB6.
DISPLAY CUB5 CUB6.
SUBTRACT SUB2 FROM D3UB6 GIVING CUB6.
DISPLAY CUB6.
DISPLAY '36 BINARY'.
SUBTRACT SUB2 FROM DBUB1 GIVING CUB1.
SUBTRACT SUB2 FROM DBUB1 GIVING CUB2.
SUBTRACT SUB2 FROM DBUB1 GIVING CUB3.
SUBTRACT SUB2 FROM DBUB1 GIVING CUB4.
SUBTRACT SUB2 FROM DBUB1 GIVING CUB5.
SUBTRACT SUB2 FROM DBUB1 GIVING CUB6.
DISPLAY CUB1 CUB2 CUB3 CUB4 CUB5 CUB6.
SUBTRACT SUB2 FROM DBUB2 GIVING CUB2.
SUBTRACT SUB2 FROM DBUB2 GIVING CUB3.
SUBTRACT SUB2 FROM DBUB2 GIVING CUB4.
SUBTRACT SUB2 FROM DBUB2 GIVING CUB5.
SUBTRACT SUB2 FROM DBUB2 GIVING CUB6.
DISPLAY CUB2 CUB3 CUB4 CUB5 CUB6.
SUBTRACT SUB2 FROM DBUB3 GIVING CUB3.
SUBTRACT SUB2 FROM DBUB3 GIVING CUB4.
SUBTRACT SUB2 FROM DBUB3 GIVING CUB5.
SUBTRACT SUB2 FROM DBUB3 GIVING CUB6.
DISPLAY CUB3 CUB4 CUB5 CUB6.
SUBTRACT SUB2 FROM DBUB4 GIVING CUB4.
SUBTRACT SUB2 FROM DBUB4 GIVING CUB5.
SUBTRACT SUB2 FROM DBUB4 GIVING CUB6.
DISPLAY CUB4 CUB5 CUB6.
SUBTRACT SUB2 FROM DBUB5 GIVING CUB5.
SUBTRACT SUB2 FROM DBUB5 GIVING CUB6.
DISPLAY CUB5 CUB6.
SUBTRACT SUB2 FROM DBUB6 GIVING CUB6.
DISPLAY CUB6.
STOP RUN.
IDENTIFICATION DIVISION.
PROGRAM-ID. CB031.
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
DATA DIVISION.
FILE SECTION.
WORKING-STORAGE SECTION.
01 SUB1 PIC 9(03) VALUE 41. 01 SUB3 PIC 9(04) VALUE 51. 01 fred pic 9(06). 01 THE-PROG. 03 THE-PROG-NOF OCCURS 100 PIC 9(06). 03 the-prog-val pic 9(06). LINKAGE SECTION.
PROCEDURE DIVISION.
MAINLINE.
DISPLAY 'CB031 STARTED'. MOVE SUB3 TO THE-PROG-val. DISPLAY THE-PROG-val. MOVE SUB3 TO THE-PROG-val (1:6). DISPLAY THE-PROG-val. MOVE SUB3 TO THE-PROG-NOF (41). MOVE SUB3 TO fred. MOVE SUB3 TO fred (2:5). DISPLAY 'FRED=' FRED. DISPLAY 'CB031 FINISHED'. STOP RUN.
IDENTIFICATION DIVISION.
PROGRAM-ID. cb038.
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
DATA DIVISION.
FILE SECTION.
WORKING-STORAGE SECTION.
01 BRUCE1 PIC S9(04) VALUE 1234+.
01 BRUCE2 PIC S9(04) VALUE 1234-.
01 BRUCE3 PIC S9(04) COMP-3 VALUE 1234+.
01 BRUCE4 PIC S9(04) COMP-3 VALUE 1234-.
01 BRUCE5 PIC S9(04) COMP VALUE 1234+.
01 BRUCE6 PIC S9(04) COMP VALUE 1234-.
01 BRUCE7 PIC X(04) VALUE '1234'.
LINKAGE SECTION.
PROCEDURE DIVISION.
MAINLINE.
DISPLAY 'cb038 STARTED'.
DISPLAY BRUCE1.
DISPLAY BRUCE2.
DISPLAY BRUCE3.
DISPLAY BRUCE4.
DISPLAY BRUCE5.
DISPLAY BRUCE6.
DISPLAY BRUCE7.
DISPLAY 'cb038 FINISHED'.
STOP RUN.
IDENTIFICATION DIVISION.
PROGRAM-ID. cb046.
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
DATA DIVISION.
FILE SECTION.
WORKING-STORAGE SECTION.
01 ICUB1 PIC s9(08).
01 freda pic x(1048576).
01 WSSS.
03 WSS OCCURS 300.
05 WS-DATA PIC X(31).
05 WS-LVL PIC X(02).
05 WS-ADDR.
07 WS-ADDR9 PIC 9(08).
05 WS-LEN.
07 WS-LEN9 PIC 9(08).
05 WS-PIC PIC X(08).
05 WS-PIC-TYP PIC X(01).
05 WS-PIC-SIGN PIC X(01).
05 WS-PIC-DEC PIC X(01).
01 WSUB1 PIC 9(04).
01 WSUB2 PIC 9(04).
01 WSCUB1 PIC 9(04).
01 WS-FIELD PIC X(31).
01 DIGIT-FOUND PIC X(01).
01 SAVE-ADDR PIC X(08).
01 SAVE-LEN PIC X(08).
01 fredb pic x(1048576).
01 ADDRESS-OF-EYECATCHER.
03 ADDRESS-OF-EYECATCHER9 PIC 9(08).
PROCEDURE DIVISION.
SUBPROGRAM.
compute icub1 = ws-addr9(wsub2)
- address-of-eyecatcher9
+ 1.
stop run.
IDENTIFICATION DIVISION.
PROGRAM-ID. CB068.
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
DATA DIVISION.
FILE SECTION.
WORKING-STORAGE SECTION.
01 W1 PIC 9V9 VALUE 1.2.
01 W2 PIC 9.9 VALUE 1.2.
01 W3 PIC 9(7)V9(2).
01 W4 PIC s9V9 VALUE -1.2.
01 W5 PIC s9.9 VALUE -1.2.
01 W6 PIC s9(7)V9(2).
LINKAGE SECTION.
PROCEDURE DIVISION.
MAINLINE.
DISPLAY W1.
DISPLAY W2.
COMPUTE W3 = 123456789 / 100.
DISPLAY W3.
DISPLAY W4.
DISPLAY W5.
COMPUTE W6 = (123456789 / 100) * -1.
DISPLAY W6.
STOP RUN.
that's all folks!
John Hennesy 30th March 2023 p.s. WordPerfect used to spellcheck my surname and suggest that it ought to be changed to 'heinous' or 'hyenas'.
Z390 DB2 FILES 17/02/23 JCLH ========== ====== ====
CBL TEST PROGRAMS
These programs didn't error in old environment and they are compiled and run via ZC390CLG there. They are in Z390\ZCOBOL\DEMO.
CB002 error 42 CB031 error 193 CB037 error 17 CB046 error 98 CB068 ZC_CALC MISSING VAR STACK PTR
CBL DB2 TEST PROGRAMS
All these cobol programs have an extension of SQB (This is the IBM convention for cobol files before preparation). After preparation, they take on the extension of CBL. They are in Z390\ZCOBOL\DEMO.
TESTALL2 TESTALL3 TESTALL4 gets S80A when run via NUATEST TESTALL5 TESTALL6 doesn't like SENSITIVE STATIC SCROLL CURSOR in NUATEST TESTALL7 TESTALL8 TESTALL9 cannot cope with sql verb WITH
CBL PROGRAMS TO ENABLE DB2
They are in Z390\ZCOBOL\DEMO.
DB2PREPY DB2PREPZ DB2CRE8 SQUELCH5 FORTY9
TEMPLATES USED BY DB2 ENABLER PROGRAMS
Z390\CRE7BIN.BIN Z390\ZCOBOL\DEMO\JHTES2YY.CBL Z390\DB2CRE8.BIN
BAT FILES
Z390\DB2PREPY Z390\DB2PREPZ Z390\DB2CRE8
Z390\NUATEST used to run the generated DB2 programs
Z390\SETUPEMP sets up test data Z390\SETDB2DA sets up more test data
Copy members
Z390\ZCOBOL\DEMO\SQLCA.CPZ it should already be there
MLC FILES
These are all modified CMDPROC modules
Z390\ZCOBOL\DEMO\START1 Z390\ZCOBOL\DEMO\START2 Z390\ZCOBOL\DEMO\START3 Z390\ZCOBOL\DEMO\WREAD1 Z390\ZCOBOL\DEMO\WREAD2 Z390\ZCOBOL\DEMO\WREAD3 Z390\ZCOBOL\DEMO\STOP1 Z390\ZCOBOL\DEMO\STOP2 Z390\ZCOBOL\DEMO\STOP3
JAVA PROGRAMS
Z390\SRC\MZ390 unchanged, but gets rid of ampersands, which can trouble zcobol Z390\SRC\SZ390 dynamic displays Z390\SRC\TZ390 temporarily disabled "properties"
MAC PROGRAMS
GENBASE WS missing prefix ZC WS outputs working-storage field details in ERR file
SPLIT DELIVERY
We are going to split the delivery of the above into manageable lumps, that won't unduly affect the existing codebase.
Most of the deliverables are new and therefore should have no impact, these will be delivered first.
They can be split arbitrarily as needed but the doco should be included in the first split
CB002.cbl CB031.cbl CB037.cbl CB046.cbl CB068.cbl
TESTALL2.sqb TESTALL3.sqb TESTALL4.sqb TESTALL5.sqb TESTALL6.sqb TESTALL7.sqb TESTALL8.sqb TESTALL9.sqb
DB2PREPY.cbl DB2PREPZ.cbl DB2CRE8.cbl SQUELCH5.cbl FORTY9.cbl
CRE7BIN.BIN JHTES2YY.CBL DB2CRE8.BIN
DB2PREPY.bat DB2PREPZ.bat DB2CRE8.bat
NUATEST.bat
SETUPEMP.bat SETDB2DA.bat
SQLCA.CPZ
START1.MLC START2.MLC START3.MLC WREAD1.MLC WREAD2.MLC WREAD3.MLC STOP1.MLC STOP2.MLC STOP3.MLC
DOCO FILES
Word documents EMBEDDED SQL IN ZCOBOL PROGRAMS V181 IMPLEMENTATION Z390db2 files for github (this document)
The following programs already exist and therefore Should be delivered separately last
SZ390.java
GEN_BASE.mac WS.mac
John Hennesy