//MWCTALP JOB (ZZXZ,504,A,10,5),'ALP TEST' /*AFTER MWCALP //JOBLIB DD DSN=ZZXZMWC.ALP.TEST.LOAD,UNIT=FILE,VOL=SER=NIHLB1,DISP=SHR // EXEC ALPGPRE,ASMLIST= //SYSIN DD * TITLE 'ALP TEST CASES'; MACRO &&LABEL: TESTMAC &&O1,&&O2; LCLA &&A; &&LABEL: L &&O1,&&O2; MEND; TEST: START; INIT REG=12,EQU=NO; EJECT; % IF - THEN AND IF - THEN - ELSE TESTS IF THEN
  • ; IF
  • THEN BEGIN SI R2,50; LR R3,R2; END ELSE LA R3,10(R2); IF RP R2 & THEN
  • ; IF & THEN
  • ; EJECT; % CASE TEST CASE R3 MAX 40; 4 THRU 36: CALL ERROR; 16: EXIT; 4,8: ; 20: CALL PROCESS; ENDCASE; CASE R3 MAX 40 MIN 4; 8 THRU 36: CALL ERROR; 16: EXIT; 12,8: ; 20: CALL PROCESS; ENDCASE THEN CALL FINISH; CASE R3 MAX 40 CHECK; 4 THRU 36: CALL ERROR; 16: EXIT; 4,8: ; 20: CALL PROCESS; ENDCASE ELSE ABEND 69,DUMP THEN CALL FINISH; CASE R3 MAX 40 MIN 4 CHECK; 8 THRU 36: CALL ERROR; 16: EXIT; 12,8: ; 20: CALL PROCESS; ENDCASE ELSE ABEND 69,DUMP; EJECT; % GOTO AND RGOTO L1: GOTO L1; L2 : GOTO L2 IF RP R5 | ; L3: RGOTO R14; RGOTO R14 IF RP R15 | ; EJECT; % LOOP TESTS % WHILE/UNTIL/FOREVER DO WHILE & DO ; UNTIL & DO ; FOREVER DO ; % DO WHILE/UNTIL/FOREVER DO WHILE & ; DO UNTIL & ; DO FOREVER; % FOR - DO AND DO - FOR FOR R4 DO BEGIN LA R5,10(R4); NEXT; XC 0(R5,8),0(R5); END; DO BEGIN LA R5,10(R4); XC 0(R5,8),0(R5); END FOR R4; WHILE DO BEGIN AI R2,1; EXIT IF ; SI R1,1; END THEN LI R1,0; EJECT; % EXIT (FROM ALL LOOP CONSTRUCTS) B1: FOREVER DO < LI R1,10; FOR R1 DO BEGIN LTR R2,R1; EXIT; EXIT IF RP R2; EXIT FROM B1; EXIT FROM B1 IF RP R2; NEXT; NEXT IF RM R2; NEXT OF B1; NEXT OF B1 IF RM R2; LA R3,R1; END > ; EJECT; % SELECT (PREDICATE CASE) SELECT; : ZR R1; : ZR R2; ENDSEL; SELECT FIRST; : ZR R1; : ZR R2; ENDSEL; SELECT; : ZR R1; : ZR R2; ENDSEL; SELECT FIRST; : ZR R1; : ZR R2; ENDSEL ELSE ; SELECT FIRST; : ZR R1; : EXIT; : NEXT; ENDSEL ELSE ; EJECT; % USING LA R5,AREA; USE R5 AS MAPBLK IN ; LA R5,AREA; LA R6,AREA2; USE R5 AS MAPBLK, R6 AS MAPBLK2 IN ; EJECT; % ASM STATEMENTS TEST ASM IF (&&B) THEN ELSE S2; ASM IF (&&B) THEN S1; ASM CASE &&X; 0: S0; 1,2: S12; 3,4, 5 THRU 8: S345; ENDCASE; ASM WHILE (&&X GT 0) DO S1; ASM UNTIL (&&X LT 0) DO THEN S2; ASM FOREVER DO BEGIN ASM IF (&&B) THEN ASM EXIT ELSE ASM NEXT; END; ASM FOR &&X FROM 1 BY 2 TO 37 DO S5; ASM FOR &&X FROM 0-1 BY 0-2 TO 0-37 DO THEN S69; ASM DO ; ASM DO WHILE (&&B) THEN ; ASM DO UNTIL (&&B); ASM DO FOREVER; ASM DO FOR &&X BY 1 TO 69; ASM DO FOR &&X; ASM SELECT; (&&B): S1; (&&C): S2; ENDSEL; .ZAP: ASM SELECT FIRST; (&&B): ; (&&C): S2; ENDSEL ELSE S3; ASM GOTO .ZIP; ASM GOTO .ZAP IF (&&B); EJECT; COMMENT; THIS IS A TEST OF THE COMMENT STATEMENT. THE COMMENT STATEMENT PERMITS FREE-FORM BLOCKS OF COMMENTARY IN ALP PROGRAMS. ALP; EJECT; UNINIT; AREA: DS F; AREA2: DS F; % DSECT ET AL MAPBLK: DSECT; BAL; MB1 DS X MB2 DS AL3 ALP; MAPBLK2: DSECT; MB3: DS X; MB4: DS AL3; END;