IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Analyzing a IBM Assembler Program


IBM Mainframe Forums -> PL/I & Assembler
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Archana_MF

New User


Joined: 21 Jul 2006
Posts: 49
Location: California

PostPosted: Thu Dec 06, 2007 12:30 am
Reply with quote

Hi All,

A Part of my project I have a Assembler routine which needs to be Analyzed for the below issue-
Last year on 20061231 the job got ABEND due to date routine which is teh Assembler Program. That time it was fixed by changing the base date in the assembler program to 1985. Previously the base date was 1979. We need to analyze this assembler program to find what the program is doing and the exact reason for the abend to check whether the same abend will occur this year also

I understand some of the Instructions but it will take lot of time to come
to an conclusion.

Could someone please take a look at the attached Porgram (Below)? someone who is an expertise in Assembler Language and can undesratnd the puropose of the program ASAP.

Thank you so much.
Please let me know for any further details
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Thu Dec 06, 2007 12:39 am
Reply with quote

Cut & paste with the code tags would be much more usefull. Your txt attachment has lost all it's formatting.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Thu Dec 06, 2007 12:46 am
Reply with quote

Hello,

To fix the formatting, right-click on "Download" and use SaveTargetAs. Many txt files will not open properly when opened in a browser window.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Thu Dec 06, 2007 12:56 am
Reply with quote

Hello,

What was the abend last year?

What are the directions for someone who wants to call this routine?

The code has been modified multiple times with little regard for explaining what was changed.

If you have no one in your organization who is familiar with assembler (nothing sophisticated is in the code), i'd suggest you re-code this in COBOL so that it can be maintained easier.
Back to top
View user's profile Send private message
Archana_MF

New User


Joined: 21 Jul 2006
Posts: 49
Location: California

PostPosted: Thu Dec 06, 2007 1:05 am
Reply with quote

AMODE 31
RMODE ANY
X01154E CSECT
ENTRY DATERTN2
DATERTN2 SAVE (14,12)
BALR 2,0
USING *,2
LA 12,SV
ST 12,8(13)
ST 13,4(12)
LR 13,12
TITLE 'HEALTH CARE, JULIAN, GREG DATE W/CC CONVERSION'
LM 3,6,0(1)
B RQTST
**
SV DS 18F
SV9 DS F
DWD DS D
F2 DC F'2'
F3 DC F'3'
****
BRTBL B GRGIN
B JULIN
B HCDIN
*****
***
* REQUEST CODE SCHEME
* CODE DATE FIELD 1-DATE FIELD 2
* 1 GREG. -N/A
* 2 JULIAN -N/A
* 3 HLTH CARE -N/A
* 4 GREG -GREG
* 5 JULIAN -GREG
* 6 HLTH CARE -GREG
* 7 GREG -JULIAN
* 8 JULIAN -JULIAN
* 9 HLTH CARE -JULIAN
* 10 GREG -HLTH CARE
* 11 JULIAN -HLTH CARE
* 12 HLTH CARE -HLTH CARE
****
*****
* * *
* PARAMETER LIST EXPECTED
* PARM VALUE
* 1 REQUEST CODE
* 2 GREG FIELD 1
* 3 JULIAN FIELD 1
* 4 HLTH CARE FIELD 1
* 5 GREG FIELD 2
* 6 JULIAN FIELD 2
* 7 HLTH CARE FIELD 2
* 8 DIFFERENCE BETWEEN FIELD1 AND FIELD 2
****
*****
EJECT
P0 DC P'0'
P1 DC P'1'
P2 DC P'2'
P4 DC P'4'
P59 DC P'59'
P60 DC P'60'
P365 DC P'365'
P1000 DC P'1000'
P100 DC P'100' Y2K
P100000 DC P'100000' Y2K
BASE DC P'1985000' SWSC28
FEB29 DC C'0229'
C03 DC C'03'
Y2K65 DC C'65' Y2K
CC20 DC P'2000000' Y2K
CC19 DC P'1900000' Y2K
CENT19 DC C'19' Y2K
CENT20 DC C'20' Y2K
***** * * * *
* * MONTH TABLE FOR GREG. TO JULIAN CONVERSION
*
MOTBL DC P'000'
DC P'031'
DC P'059'
DC P'090'
DC P'120'
DC P'151'
DC P'181'
DC P'212'
DC P'243'
DC P'273'
DC P'304'
DC P'334'
DC P'365'
* * *
*****
LP DS CL1
WK1 DS CL1
HC DS CL4
JUL DS CL7 Y2K
GDAT DS CL8 Y2K
CC DS PL8 Y2K
HYR DS CL2
MO DS CL2
DAY DS CL2
YRDIF DS CL4
EJECT
RQTST MVI GODIFF+1,X'00'
PACK DWD,0(2,3) CALC BRANCH INDEX, EQUAL TO (REQ-1)/3
CVB 9,DWD IF REMAINDER IS 0- DATE IS GREG.
BCTR 9,0 1- DATE IS JULIAN
SR 8,8 2- DATE IS HLTH CARE
D 8,F3
LR 14,9 SAVE QUOTIENT FOR 2ND DATE FIELD DEFN.
SL9 SLL 8,2 MULTIPLY BY 4 AND
B BRTBL(8) USE AS INDEX

* RETURN HERE FROM ALL DATE CONVERSIONS
* IF NO DIFFERENCE REQUESTED, EXIT FROM ROUTINE
*IF A DIFFERENCE HAS BEEN REQUESTED, FIRST CONVERT given date
* FIELD TWO AND THEN SUBTRACT THE TWO FIELDS

RTRN EQU *
CLC 0(2,3),C03 IS SECOND FIELD AND difference rested
BNH XIT IF NOT, EXIT
GODIFF BC 0,DIFF SECOND TIME THRU - Determine Diff
MVI GODIFF+1,X'F0'

* FIRST TIME THROUGH, CONVERT DATE FIELD TWO TO OTHER FORMS

LR 8,14 LOAD QUOTIENT FROM DIVIDE ABOVE
BCTR 8,0
LM 4,6,16(1) LOAD SECOND DATE FIELD ADDRESSES
B SL9 GO TO CALC BRANCH INDEX

* CALCULATE DIFFERENCE BETWEEEN DATES USING HLTH CARE
DIFF EQU *
L 3,12(1) HLTH CARE FIELD 1
L 4,24(1) HLTH CARE FIELD 2
L 5,28(1) DIFFERENCE BUCKET
PACK DWD(3),0(4,3) PACK
PACK DWD+4(3),0(4,4) DATES
SP DWD(3),DWD+4(3) FLD 1 MINUS FLD 2
UNPK 0(4,5),DWD(3) STORE
OI 3(5),X'F0' UNPACKED DIFFERENCE
****
XIT EQU *
L 13,SV+4
RETURN (14,12)
EJECT

* DATE CONVERSION ROUTINES BRANCH TO VIA BRTBL AND CALCULATED INDEX
* BASED UPON THR REQUEST CODE

* GREGORIAN GIVEN - RETURN JULIAN AND HLTH CARE
GRGIN EQU *
LR 8,4 ADDRESS OF SUPPLIED GREG. DATE
BAL 9,GREGJUL CONVERT TO JULIAN
* MVC 0(7,5),JUL STORE Y2K
MVC 0(5,5),JUL+2 STORE Y2K
* LA 8,JUL ADDRESS OF JULIAN Y2K
LR 8,5 ADDRESS OF JULIAN Y2K
BAL 9,JULHC CONVERT TO HLTH CARE
MVC 0(4,6),HC STORE
B RTRN

* JULIAN GIVEN - SUPPLY GREGORIAN AND HLTH CARE
JULIN EQU *
LR 8,5 ADDRESS OF SUPPLIED JULIAN
BAL 9,JULGRG CONVERT TO GREGORINN
MVC 0(8,4),GDAT STORE Y2K
LR 8,5 ADDRESS OF SUPPLIED JULIAN
BAL 9,JULHC CONVERT TO HLTH CARE
MVC 0(4,6),HC
B RTRN


** HEALTH CARE GIVEN - CONVERT TO GREGORIAN AND JULIAN
HCDIN EQU *
LR 8,6 ADDRESS OF SUPPLIED HLTH CARE DATE
BAL 9,HCJUL CONVERT TO JULIAN
* MVC 0(7,5),JUL STORE Y2K
MVC 0(5,5),JUL+2 STORE Y2K
* LA 8,JUL ADDRESS OF JULIAN Y2K
LR 8,5 ADDRESS OF JULIAN Y2K
BAL 9,JULGRG CONVERT TO GREGORIAN
MVC 0(8,4),GDAT STORE Y2K
B RTRN

EJECT
*
* CONVERT HEALTH CARE TO JULIAN
HCJUL EQU *
ST 9,SV9
PACK DWD,0(4,8) PACK HLTH DATE
DP DWD,P365 DIVIDE BY 365 DAYS
ZAP HYR,DWD+4(2) STORE NUMBER OF YEARS FROM BASE YR
NLYCAL AP DWD(6),P1 YR PLUS 1 DIVIDED
DP DWD(6),P4 BY 4 YIELDS NO. OF LEAP YEARS
CP DWD(5),DWD+6(2) IF NO. OF LEAP YEARS GREATER THAN
BL FNSH REMAINDER DAYS,
SP HYR,P1 SUB. ONE FROM NO. OF YEARS
AP DWD+6(2),P365 ADD 365 TO NO. OF DAYS
ZAP DWD(6),HYR RECALCULATE NUMBER
B NLYCAL OF ELAPSED LEAP YEARS SINCE BASE YEAR
FNSH EQU *
SP DWD+6(2),DWD+3(2) SUBTRACT NO.OF LP YRS FROM DAYS
ZAP DWD(6),HYR ADD YEARS TO DAYS
MP DWD(6),P1000 TO FORM YYDDD
AP DWD(6),DWD+6(2) YYDDD
AP DWD(6),BASE ADD BASE TO YEAR AND DAYS
UNPK JUL,DWD+2(4) RESULT IS JULIAN DATE Y2K
OI JUL+6,X'F0' Y2K
L 9,SV9
BR 9

* CONVERT GREGORIAN DATE TO JULIAN
*
GREGJUL EQU *
ST 9,SV9
PACK DWD,0(2,8) PACK MONTH OF GREG DATE
PACK DAY,2(2,8) PACK DAY
CVB 9,DWD
LA 10,MOTBL ADDRESS OF DAY-MONTH TABLE
BCTR 9,0 MONTH MINUS ONE
SLL 9,1 TIMES 2
AR 10,9 EQUALS DAYS ELAPSED IN PRECEDING MONTHS
AP DAY,0(2,10) ADD TO DAY OF GREG. DATE
*
DIVYR EQU *
CLC 0(4,8),FEB29 LEAP YEAR NO CONCERN IF BEFORE 02/29
BNH NLP IF 02/29 OR BEFORE, LEAP YEAR N/A
PACK DWD,6(2,8) PACK YEAR AND Y2K
DP DWD,P4 DIVIDE BY 4
CP DWD+7(1),P0 IF REMAINDER ZERO,
BNE NLP NOT A LEAP YEAR
AP DAY,P1 DAY PLUS ONE

NLP EQU *
PACK DWD,6(2,8) PACK YEAR Y2K
MP DWD,P1000 SHIFT
AP DWD,DAY ADD DAYS TO FORM YYDDD
PACK CC,4(2,8) PACK CC Y2K
MP CC,P100000 SHIFT Y2K
AP DWD,CC ADD CC Y2K
UNPK JUL,DWD+4(4) Y2K
OI JUL+6,X'F0' Y2K
L 9,SV9
BR 9

* JULIAN DATE TO FOUR CHARACTER HEALTH CARE DATE
*
JULHC EQU *
PACK JUL,0(5,8) PACK JULIAN YYDDD
CLC 0(2,8),Y2K65 IS YY GE 65
BNL GEY2K65 YES
AP JUL,CC20 NO - ASSUME CC 20
B SUBBASE
GEY2K65 DS 0H YY GE 65 - ASSUME CC = 19 Y2K
AP JUL,CC19 ASSUME CC 19 Y2K
SUBBASE DS 0H Y2K
SP JUL,BASE SUBTRACT 1978000 - THE BASE JULIAN DATE
ZAP DWD,P0
MVO DWD,JUL+2(3) ISOLATE YEARS DIFFERENCE FROM 70
ZAP YRDIF,DWD+6(2) SAVE YEARS ELAPSED
MP DWD,P365 MULT. YEARS BY 365 TO DERIVE DAYS
AP YRDIF,P1 YEARS PLUS 1 DIVIDED BY
DP YRDIF,P4 4 YIELDS NO. OF LEAP YEARS PASSED
AP DWD,YRDIF(3) ADD NO. OF LEAP YEARS TO HLTH DAYS
NI JUL+4,X'00' ADD DAYS OF JULIAN DATE Y2K
AP DWD,JUL TO HEALTH CARE DAYS
UNPK HC,DWD+5(3) STORE
OI HC+3,X'F0'
BR 9

* JULIAN DATE TO GREGORIAN DATE CONVERSION
*
JULGRG EQU *
ST 9,SV9
ZAP LP,P0
PACK DWD,0(2,8) PACK SUPPLIED JULIAN DATE YEAR Y2K
DP DWD,P4 DIVIDE BY 4 TO TEST LEAP YEAR
PACK DWD+5(2),2(3,8) STORE DAYS OF JULIAN DATE Y2K
CP DWD+7(1),P0
BNE NLPA
CP DWD+5(2),P60 LEAP YEAR - TEST IF 02/29
BL NLPA IF BEFORE - LEAP YEAR NOT A CONCERN
BE SET29 IF EQUAL - MOVE 02/29
ZAP LP,P1 LEAP YEAR INCREMENT OF ONE DAY
NLPA EQU *
LA 9,MOTBL+2 DAYS-ELAPSED-BY-MONTH- TABLE
ZAP MO,P1 START WITH MONTH EQUAL TO ONE
ZAPTBL ZAP DWD(2),0(2,9) DAYS FROM TABLE
AP DWD(2),LP ADD LEAP YEAR INCREMENT
CP DWD+5(2),DWD(2) COMPARE JULIAN DAYS TO TABLE
BNH SUBDAY IF LESS OR EQUAL - MONTH FOUND
AP MO,P1 IF HIGH - MONTH PLUS ONE
LA 9,2(9) NEXT TABLE ENTRY
B ZAPTBL GET NEXT MONTH
*
SUBDAY EQU *
S 9,F2 CALCULATE DAYS INTO MONTH BY
SP DWD+5(2),0(2,9) SUBTRACTING Prev Months ELAPSED
SP DWD+5(2),LP DAYS AND LEAP YEAR INCREMENT
UNPK GDAT+2(2),DWD+5(2) STORE
UNPK GDAT(2),MO GREGORIAN
OI GDAT+1,X'F0' DATE
OI GDAT+3,X'F0'
MVYR MVC GDAT+6(2),0(8) YY Y2K
CLC GDAT+6(2),Y2K65 YY GE 65 Y2K
BL MVCC20 NO - AUME CC=19 Y2K
MVC GDAT+4(2),CENT19 CC = 19 Y2K
B ENDCC Y2K
MVCC20 DS 0H CC = 20 Y2K
MVC GDAT+4(2),CENT20 CC = 20 Y2K
ENDCC DS 0H Y2K
L 9,SV9
BR 9
SET29 MVC GDAT(4),FEB29
B MVYR
CSECT

DC CL21'001X01154E 12/31/97'
END DATERTN2

B MVYR
CSECT
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Thu Dec 06, 2007 1:06 am
Reply with quote

I just looked at IT...

Did You look at the comments ?

I will reread them for You..

the purpose of the routine is to convert and calculate date differences
between different date formats..

gregorian ( day/month/year ) in any combination ( it' s still gregorian ! )
julian year/days
health ... 4 chars seems that it is the number of days since 1978, really 1985
some idtent changed the value but not the comment...

as a side note one of the worst assembler I have ever seen around
also worst analysis, very poor knowledge of date computation issues..

they keep shifting the base because the health date is only a four digit offset from the starting base ...

if they keep up with this poor philosophy
the day they put the new routine in production with a new offset to avoid overflows
they will have two equal unhealthy health dates which really mean two dates at a 7 years distance ( for the last change )
Back to top
View user's profile Send private message
Archana_MF

New User


Joined: 21 Jul 2006
Posts: 49
Location: California

PostPosted: Thu Dec 06, 2007 1:06 am
Reply with quote

Hi,

I have sent a mail across to a COmmon ID of Programmers asking if anyone have any idea about it but not much replies.

And the person who changed this routine last time has left the Org.


Thanks
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Thu Dec 06, 2007 1:09 am
Reply with quote

strange he was not kicked away before, for his bad programming !
Back to top
View user's profile Send private message
Archana_MF

New User


Joined: 21 Jul 2006
Posts: 49
Location: California

PostPosted: Thu Dec 06, 2007 1:24 am
Reply with quote

The Abend that happened last time was a S0C7 abend last time. S0C7 abend now happens when ASM is trying to convert JULIAN -à Healthcare date

e.s.

Could you please be more elaborate the impact of Base while converting the Julian date to Healthcare.

Thank You
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Thu Dec 06, 2007 1:45 am
Reply with quote

everything depends on the range of dates You are working on
the heath date is four chars which gives a range of 0 to 9999
which approximately give a range of 27 and a half years from the base date
now if You try to process a date 27 and a half past jan 1 1985
which is 2012 You will get troubles,

somebody should explain the use of the health date and take a decision on
how to change to avoid the periodic change to the program
Back to top
View user's profile Send private message
Archana_MF

New User


Joined: 21 Jul 2006
Posts: 49
Location: California

PostPosted: Thu Dec 06, 2007 1:47 am
Reply with quote

Thank you all for the Inputs.
Great help.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Thu Dec 06, 2007 1:51 am
Reply with quote

if You have any questions hurry up... :-)
i will be at my pc for a couple of hours maybe,

tomorrow morning I have an early raise to go
ICE CLIMBING ( frozen water falls )
( I wish I could go to VAIL - Colorado )
and I will not be back until monday
Back to top
View user's profile Send private message
Archana_MF

New User


Joined: 21 Jul 2006
Posts: 49
Location: California

PostPosted: Thu Dec 06, 2007 1:52 am
Reply with quote

Thank you e.s.
Back to top
View user's profile Send private message
Archana_MF

New User


Joined: 21 Jul 2006
Posts: 49
Location: California

PostPosted: Thu Dec 06, 2007 1:53 am
Reply with quote

Nope. I Understood the reason and you are right its not a good way of coding.

I just figured it out and was about to post it to you for confirmation and by then you replied .

Thank you
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> PL/I & Assembler

 


Similar Topics
Topic Forum Replies
No new posts Using API Gateway from CICS program CICS 0
No new posts DB2 Event passed to the Application P... DB2 1
No new posts How to pass the PARM value to my targ... COBOL Programming 8
No new posts REXX code to expand copybook in a cob... CLIST & REXX 2
No new posts EZT program to build a flat file with... All Other Mainframe Topics 9
Search our Forums:

Back to Top