You might want to consider using this (or a similar) code sequence. It eliminates the use of EXECUTE instructions and verifies that the length of the source data is acceptable, i.e., the length is positive and does not exceed the length of the "work area" (field PWORK16). And, of course, it validates the data as being in the Packed Decimal format.
[Note: I shifted the code right a couple of columns and put a non-blank in column one to avoid strange text flowing problems with the list server system.] : ZAP PWORK16,KP0 Initialize the area to : * receive the Packed Decimal : * item. : * : CLFI R2,L'PWORK16 * Br if the length of the : JH NOTGOOD * source item is greater : * * than the length of the : * * work area. : * : LNR R15,R2 * Negate the source item : JZ NOTGOOD * length and branch if : * * zero. : * : LA R14,PWORK16+L'PWORK16(R15) : * Set the MVCL 'To' adrs. : LR R15,R2 Set the MVCL 'To' length. : LR R0,R1 Set the MVCL 'From' adrs. : LR R1,R2 Set the MVCL 'From' length. : * : MVCL R14,R0 Copy the source item to : * the work area (right aligned). : * : TP PWORK16 * Verify the copy of the : JNZ NOTGOOD * source item is valid : * * Packed Decimal format. : * : * ----- do something with the validated data. : * : * : NOTGOOD DC 0H'0' : MVC MACRO,=CL8'CONVERT' : LR R5,R7 : LHI R15,-7 : B RETERR : * : KP0 DC PL1'0'
