用PIC型中间变量解决Fixed赋值溢出abend

我在Debug一个PLI程序PRGM000的时候遇到了一个CEE34A abend,报的错误信息如下:
You were prompted because the CEE34A condition was raised in your
program.
CEE34A is a severity or class 3 condition.
The operating system has generated the following message:
CEE3210S The system detected a decimal-overflow exception (System
Completion Code=0CA).
The current location is PRGM000 ::> PRGM000 :> 2688.

不废话,直接上截图:
CEE3201S 0CA abend

从图上可以看出,出错的语句是:TBL_KEY1.TRADE_DATE = COMM_AREA.TRADE_DATE

我们来看二者的定义:
COMM_AREA.TRADE_DATE的定义:
1 COMM_AREA
2 USER_AREA,
...
5 TRADE_DATE FIXED(9), /* 20110901 */
...;

TBL_KEY1.TRADE_DATE的定义
DCL 1 TBL_KEY1
3 SPARE_CLIENT CHAR(4),
3 IDENT_ID CHAR(9),
3 TRADE_DATE FIXED(7),
3 NUM FIXED(3);

所以很明显,发生abend的原因是把一个FIXED(9)的值赋给了一个FIXED(7)的变量,从而产生了溢出。

下面是解决办法:
定义一个PIC类型的中间变量”PIC_TRADE_DATE_9″做转换桥梁:

DCL PIC_TRADE_DATE_9 PIC '(9)9' INIT(0);
PIC_TRADE_DATE_9 = COMM_AREA.TRADE_DATE;
(值:020110901)        (值:20110901)
TBL_KEY1.TRADE_DATE = SUBSTR (PIC_TRADE_DATE_9,4,6);
(值:110901)          (值:110901)

到这里,问题已经得到解决。
(ps:谁能知道wordpress如何能保持代码的对齐啊?晕死的这个…)

分享到:

利用SRCHFOR在PDS中搜索字符串

之前的文章说到了一个叫”Mem xxx“的命令可以用来在一系列PDS中搜索一个名字叫做xxx的member,那么今天我来说下如何在一个PDS里面所有的member内容当中搜索特定字符串。其实就是利用search-for 的应用程序,比较常规的方法是道ISPF的3.14菜单里面搜索,如下图所示,就是在 “IBMUSER.PROJ.TEST.JCL”这个PDS里面所有的member内容中,搜索一个叫“STRING”的字符串:

PDS SRCHFOR search-for utility

当然,如果你想直接在当前PDS下调用search-for utility来搜索特定字符串,可以在command line上输入命令:SRCHFOR “STRING”来在当前PDS下面搜索字符串”STRING“,具体如下面2张截图所示:
PDS SRCHFOR search-for utility

PDS SRCHFOR search-for utility

如果我想同时在多个PDS当中搜索一个字符串,或者多个字符串那么该如何做呢?这时你可能就需要用到JCL来调用ISRSUPC这个utility了。这个ISRSUPC的功能可强大多了,具体可以参照下我之前的文章:用ISRSUPC在PDS所有member中搜索指定字符串,这里就不再重复了。

分享到:

Job(JCL)返回码

提交JCL最常见的返回码就是0、4、8、12、16,当然还有ABEND。

CC=0   作业正确执行(Executed Successfully)
CC=4   警告 一般不影响作业执行 (Executed Successfully but with warnings)
CC=8   作业可以执行,但执行的不完整 (Error)
CC=12  作业不能执行 (Serious Error)
CC=16  严重错误,中断后续命令的执行(Fatal Error)
ABEND  作业异常终止

下面是一些常见的JCL ABEND CODES:
S0C4 : Protection Abend.Caused by the subscript being out of range
S0C5 : Addressing Abend.Caused by invalid address specification. i.e. The address points
to an instruction, control word or data outside the available real storage
S0C7 : Caused by a bad data. i.e. Data exception. When we are moving an alphanumeric field to a numeric computational field this Abend occurs. The result is an Abend failure
S222 : Caused by a job being cancelled by the operator, due to a request by the program for an unavailable resource.
S237 : Caused by end of volume being encountered.
S322 : Caused when CPU time assigned to the job, job step, or procedure has been exceeded. i.e. Time out error.
S413 : This abend occurs if the DD statement referenced by UNIT=AFF statement is not closed before the DD statement that comes before it.
S522 : Caused when a wait state exceeds an installation-defined time limit.
SB37 : Caused by lack of sufficient Secondary space
SD37 : Caused by lack of sufficient Primary space
SE37 : Caused by lack of space for PDS (Partitioned data set)
S722 :Too many lines of print.
S804 :Region too small for the program.
S806 :Program not on the library. May need a JOBLIB or STEPLIB.
S80A :Region too small for the program.
S913 :Security violation.
SB14 :No space in a library directory for this member’s name.
SB37 :Insufficient disk space.
S0C1 :Executing a program with an unresolved external reference.
S042 :Privileged Operation Abend.Read/write to unopened file
S0C6 :Specification Abend
S0CB :Attempting to divide by 0 and not using ON SIZE ERROR
U1002:Conflicting file attributes. See S013.
U1005:Executing with modules compiled both with RES and NORES
U1006:Subscript out of range
U1017:Missing DD statement in JCL for DISPLAY or ACCEPT verb
U1020:Problem opening or processing a file.Check the file status.
U1035:Conflicting DCB parameters. Same as S013.
U1056:Program didn’t close a file before ending
U4038:COBOL LE intercepted the Abend. Messages in CEEDUMP.

Job异常终止(Abend)的原因很多,返回码也是列不完的。上述仅仅是列举了稍微比较常见的abend返回码而已。在遇到具体返回码的时候,还是需要查manual,看job log。当然,如果你所在的公司恰好也安装了类似于MVS/QuickRef的帮助文档,那就再好不过了,只需一个命令:QW xxx即可随时查看返回码。具体可以参看我之前写的一篇文章: QW命令——MVS/QuickRef帮助文档。当然,如果没有安装这类的帮助文档,那也没关系,因为任何时候,Google和baidu都是你最好的帮手。

分享到: