I am extracting business rules from a COBOL program to write an equivalent Java program. My COBOL program is calling an assembler program with 3 parameters. I am not very good at assembler.
I am not able to understand the functionality of the assembler program. Could some one explain me the logic or help me with pseudo code. Here is the code.
Code:
DC_CBL DSECT
NAME DS CL8
E11 DS F
L11 DS F
SPACE 5
AMODE 31
RMODE ANY
BEGINING CSECT
BR 15
SPACE 3
USING DC_CBL,3
DC AL1(7)
DC CL7'PGMAIMS'
ENTRY LOADING
USING LOADING,4
LOADING STM 14,4,12(13)
LR 4,15
L 3,0(3)
LA 3,0(3)
C 3,12(3)
BE CALLING
NC 8(8,3),8(3)
BZ MODLOAD
LA 1,9005
ABEND (1)
MODLOAD LOAD EPLOC=NAME
ST 0,8(3)
ST 3,12(3)
MODELES XR 2,2
BSM 2,0
LTR 2,2
BZ CHKMOD24
TM 8(3),X'80'
BO LOADOK12
LA 1,9007
ABEND (1)
CHKMOD24 TM 8(3),X'80'
BZ LOADOK12
LA 1,9006
ABEND (1)
SPACE 2
LOADOK12 NOPR 0
CALLING LM 14,1,12(13)
AL 1,KEY4
L 15,8(3)
LM 2,4,(12+(4*4))(13)
XC 12((7*4),13),12(13)
BR 15
LA 0,9008
ABEND (0)
KEY4 DC F'4'
DROP 4
EJECT
DC AL1(7)
DC CL7'PGMEIMS'
ENTRY DELETEE
USING DELETEE,4
DELETEE STM 14,12,12(13)
LR 4,15
L 3,0(1)
L 3,0(3)
LA 3,0(3)
C 3,12(3)
BE DEL_OKAY
NC 8(8,3),8(3)
BZ DELETEOK
LA 0,9005
ABEND (0)
DEL_OKAY DELETE EPLOC=NAME
LTR 15,15
BZ DELETEOK
LA 1,3507(15)
ABEND (1)
DELETEOK XC 8(8,3),8(3)
LM 14,12,12(13)
BR 14
CNOP 4,8
DC AL2(*-BEGINING+12)
DC CL8'PGMAIMSZ',XL2'971A'
DS 0X
END
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
satish.ms10 wrote:
Let me know if I missed any required information.
The name of the idiot who wrote the COBOL program? I mean, we only have 30 characters for data-names and in RET1 and RET2 they've used four more than absolutely necessary. What a waste of typing.
Of course, now the names are no real help in understanding what the program does. But that is minor, a few hours or days wasted later, whilst they managed to implement 0.2s more quickly.
Someone with IMS knowledge may be able to say something as to why, but it seems to be a program used to load, if necessary, then call, and, separate entry-point, so at some other logical point, delete - programs.
I think it is something local to your site ("LOADING" is a silly name for a program). Ask around there.
This may be a throwback to older times (Language Environment does this stuff from for COBOL CALLs) and may not be required at all.
As well as asking around, see if anyone IMS turns up here, or someone to fill in the details on the ASM.
Presumably you already have details on how your Java is going to run and interact successfully. I don't think you'll be needing a "loader", but if you do, someone has presumably mentioned it to you or documented it somewhere along the way in the design.
Joined: 30 Nov 2013 Posts: 917 Location: The Universe
Well, there are other issues.
As written, the program will not assemble. I very much doubt the program, in the form it was presented by satish.ms10 is actually used.
As written, it seems the program expects register 3 to be pointing to the ARG01 structure. It is totally foolish to expect anything like this in compiled code. Again, I very much doubt the program, in the form it was presented by satish.ms10 is actually used.
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
The LA instruction of a value into R1 just prior to the ABEND is too large. Max value for an LA is 4095. Change the LA to an LHI (max=32767) or an LAY (max=524287). Other than that, I agree this program needs further scrutiny and resolve.
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
Just a thought.
Assuming this is a Batch program, review PROCEDURE-POINTER (introduced with COBOL/370 in the early 1990's), which acts like an Assembler "LOAD" Macro under the covers.
You can use PROCEDURE-POINTER directly in the Batch COBOL program.
Use the CICS API "LOAD PROGRAM" in CICS environments.