*************** Beginning of data *****************************
0001.00 PGM
0002.00 DCL VAR(&STR1) TYPE(*CHAR) LEN(20)
0003.00 DCLF FILE(CUSERJ/FILE02P)
0004.00 DCL VAR(&T22) TYPE(*LGL) VALUE('1')
0005.00
0006.00 DOWHILE COND(&T22)
0007.00 RCVF
0008.00 MONMSG MSGID(CPF0864) EXEC(GOTO CMDLBL(END))
0009.00 CHGVAR VAR(&STR1) VALUE(&JOBJOB)
0010.00 SNDPGMMSG MSG(&STR1) MSGTYPE(*COMP)
0011.00 DLYJOB DLY(10)
0012.00 ENDDO
0013.00 END: SNDPGMMSG MSG(' FILE02P IS END ') MSGTYPE(*COMP)
0014.00 DLYJOB DLY(10)
0015.00 ENDPGM
****************** End of data ********************************
1. 一个CL中只能DCLF一个file, 即一个CL中只能使用一个file
2. CL中DCLF的file, 其各个字段(field)会自动被编译定义为变量(DCL), 这些字段变量可以直接使用.
一个小问题: 程序运行过程中display的msg是看不到的, 只有程序运行完在display all message时才能看到每个msg的内容...
结果如图:
Display All Messages
System: A102CD8M
Job . . : QPADEV0070 User . . : CUSERJ Number . . . : 020968
4>> call cl11
B
QPADEV007S
QPADEV007S
QPADEV007S
QDFTJOBD
End of file detected for file FILE02P in CUSERJ.
FILE02P IS END
B
QPADEV007S
QPADEV007S
QPADEV007S
QDFTJOBD
FILE02P IS END
Bottom
Press Enter to continue.
F3=Exit F5=Refresh F12=Cancel F17=Top F18=Bottom
程序中用的PF(CUSERJ/FILE02P)的DDS定义:
FMT PF .....A..........T.Name++++++RLen++TDpB......Funct
*************** Beginning of data ***************
0001.00 R F02R
0002.00 PGMNAME 10A
0003.00 TS Z
0004.00 CURUSR 10A
0005.00 JOBJOB 10A
0006.00 JOBUSR 10A
0007.00 JOBNBR 10A
0008.00 INFOR 50A
****************** End of data ******************
其内容如下:
Line ....+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8....+....9....+...10
PGMNAME TS CURUSR JOBJOB JOBUSR JOBNBR INFOR
000001 RPG02 2013-04-02-10.19.55.453000 A B C D
000002 RPG02 2013-04-02-10.25.38.726000 CUSERJ QPADEV007S CUSERJ 019448
000003 RPG02 2013-04-02-11.30.30.248000 CUSERJ QPADEV007S CUSERJ 019457
000004 RPG02 2013-04-02-11.32.41.405000 CUSERJ QPADEV007S CUSERJ 019457
000005 RPG02 2013-04-02-11.33.51.479000 CUSERJ QDFTJOBD CUSERJ 019458
****** ******** End of report ********
阅读(1726) | 评论(0) | 转发(0) |