免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
楼主: i400as
打印 上一主题 下一主题

RCVF的用法 [复制链接]

论坛徽章:
0
11 [报告]
发表于 2008-12-08 13:37 |只看该作者
要不你把代码贴全,我们试试 .

[ 本帖最后由 digitalchina 于 2008-12-8 13:39 编辑 ]

论坛徽章:
0
12 [报告]
发表于 2008-12-08 13:42 |只看该作者
DCLF FILE(INPUT) OPNID(INFILE1)
:
RCVF OPNID(INFILE1)

论坛徽章:
0
13 [报告]
发表于 2008-12-08 13:44 |只看该作者

看看有没有用?

Example 1: Receive Data from Database File

DCLF FILE(MENU1)
:
RCVF OPNID(*NONE) The CL procedure receives data from the database file named MENU1. The RCVF command is associated with the Declare File command that does not have an open file identifier specified.



Example 2: Receive Data from Display Device

DCLF FILE(SCREENX) RCDFMT(R1 R2)
:
RCVF DEV(DISPLAY2) RCDFMT(R1)

The CL procedure receives data from the user at the display station named DISPLAY2. The data is received in the record format named R1 in the device file named SCREENX. The procedure waits for the user data before it continues processing.



Example 3: Handling End-of-File Exception

DCLF FILE(INPUT) OPNID(INFILE1)
:
RCVF OPNID(INFILE1)
MONMSG CPF0864 EXEC(GOTO EOF)

The CL procedure receives a record sequentially from the database file named INPUT. The procedure monitors for the end-of-file exception CPF0864 and goes to label EOF when the message is received.



Example 4: Using RCVF with WAIT command

DCLF FILE(MSCREEN) RCDFMT(MIN1 MIN2 MIN3)
:
RCVF DEV(&DNAME) RCDFMT(MIN2) WAIT(*NO)
WAIT DEV(&DNAME)

The CL procedure receives user data from several devices one at a time by way of the device file named MSCREEN. The procedure receives data from the device named in the variable &DNAME using the record format MIN2, but it does not wait for the data to come in. The same RCVF command is used to receive data from several devices; because the CL variable &DNAME is used, only the device name in the DEV parameter must be changed each time the command is run. A WAIT command for each device must be issued later in the procedure because the WAIT command actually receives the data. Both the RCVF and the WAIT commands may be processed for each device (one at a time) to send data to the procedure. If a user response is delayed, the commands can be processed as many times as necessary until the user responds with the data or a End Receive (ENDRCV) command cancels the request.

论坛徽章:
0
14 [报告]
发表于 2008-12-08 13:49 |只看该作者
0001.00 PGM                                                                                          
0002.00              DCLF       FILE(LIBL/ENDJOBD)                                                   
0003.00              DCL        VAR(&IDNAM1) TYPE(*CHAR) LEN(10) VALUE(' ')               
0004.00              DCL        VAR(&JOBNAME) TYPE(*CHAR) LEN(10) VALUE(' ')                           
0005.00              DCL        VAR(&JOBNAME1) TYPE(*CHAR) LEN(10) VALUE(' ')              
0006.00 /* DISPLAY */                                                                       
0007.00              CHGVAR     VAR(&IDNAM) VALUE(' ')                                                
0008.00              SNDRCVF    RCDFMT(ENDJOB)                                                        
0009.00 /*   */                                                                                       
0010.00              DLTF       FILE(LIBL/JOBENDP)                                                   
0011.00              CRTPF      FILE(LIBL/JOBENDP) RCDLEN(9999) OPTION(*SRC) +                        
0012.00                           LVLCHK(*NO)                                                        
0013.00              WRKACTJOB  OUTPUT(*PRINT)                                                   
0014.00              CLRPFM     FILE(LIBL/JOBENDP)                                          
0015.00              CPYSPLF    FILE(QPDSPAJB) TOFILE(LIBL/JOBENDP) +                                 
      
0016.00                           SPLNBR(*LAST) CRTDATE(*LAST)                                       
0017.00              RCVF                                                                              
0018.00              MONMSG     MSGID(CPF0864) EXEC(GOTO CMDLBL(END))                                 
0019.00              CHGDTAARA  DTAARA(*LDA *ALL) VALUE(JOBENDP)                                   
0020.00              RTVDTAARA  DTAARA(*LDA (10 10)) RTNVAR(&JOBNAME)                           
0021.00                                                                                         
0022.00              CHGVAR     VAR(&IDNAM1) VALUE(&IDNAM)                                      
0023.00              CHGVAR     VAR(&JOBNAME1) VALUE(&JOBNAME)                                 
0024.00                                                                                         
0025.00              IF         COND(&JOBNAME1 *EQ &IDNAM1) THEN(DO)                           
0026.00              ENDJOB     JOB(&JOBNAME) OPTION(*IMMED)                                    
0027.00              ENDDO                                                                     
0028.00   /*         DLTOVR     FILE(JOBENDP)        */                                         
0029.00 END:                                                                                   
0030.00 ENDPGM

谢谢大家了。。

论坛徽章:
0
15 [报告]
发表于 2008-12-08 13:59 |只看该作者
谢谢digitalchina  

这个问题解决了,呵呵。。

论坛徽章:
0
16 [报告]
发表于 2008-12-08 14:02 |只看该作者
你不是用过 SNDRCVF    RCDFMT(ENDJOB)      ?

这里还是用它.

论坛徽章:
0
17 [报告]
发表于 2008-12-08 14:06 |只看该作者
0008.00              SNDRCVF    RCDFMT(ENDJOB)    这行是DSPF,是显示文件。

0011.00              CRTPF      FILE(LIBL/JOBENDP) RCDLEN(9999) OPTION(*SRC) +   这个是数据文件,不同的哦。不过,
0013.00              WRKACTJOB  OUTPUT(*PRINT)    这个出来的是PRTNT文件。

0019.00              CHGDTAARA  DTAARA(*LDA *ALL) VALUE(JOBENDP)                                   
0020.00              RTVDTAARA  DTAARA(*LDA (10 10)) RTNVAR(&JOBNAME)           这个(&JOBNAME)取不到值,我晕了。

论坛徽章:
0
18 [报告]
发表于 2008-12-08 14:15 |只看该作者
你的程序不全,太多地方要改.

不过我看了下SPOOL FILE

400-              DCLF       FILE(TESTLIBL/ACTJOBLIST)                 
     QUALIFIED FILE NAME - TESTLIBL/ACTJOBLIST                        
        RECORD FORMAT NAME - ACTJOBLIST                              
          CL VARIABLE     TYPE     LENGTH     PRECISION     TEXT     
           &ACTJOBLIST    *CHAR     200                              

从这里可以看到RCDFMT 是和文件名一样的.

论坛徽章:
0
19 [报告]
发表于 2008-12-08 14:23 |只看该作者
PGM
             DCLF       FILE(LIBL/ENDJOBD) ----DSPF
             DCLF       FILE(LIBL/JOBENDP) OPNID(JOBENDPR) ----PF
             DCL        VAR(&IDNAM1) TYPE(*CHAR) LEN(10) VALUE(' ')
             DCL        VAR(&JOBNAME) TYPE(*CHAR) LEN(10) VALUE(' ')
             DCL        VAR(&JOBNAME1) TYPE(*CHAR) LEN(10) VALUE(' ')
/* DISPLAY */
             CHGVAR     VAR(&IDNAM) VALUE(' ')
             SNDRCVF    RCDFMT(ENDJOB)
/*   */
             DLTF       FILE(LIBL/JOBENDP)
             CRTPF      FILE(LIBL/JOBENDP) RCDLEN(9999) OPTION(*SRC) +
                          LVLCHK(*NO)
             WRKACTJOB  OUTPUT(*PRINT)
             CLRPFM     FILE(LIBL/JOBENDP)
             CPYSPLF    FILE(QPDSPAJB) TOFILE(LIBL/JOBENDP) +
                          SPLNBR(*LAST) CRTDATE(*LAST)
             RCVF       OPNID(JOBENDPR)
             MONMSG     MSGID(CPF0864) EXEC(GOTO CMDLBL(END))
             CHGDTAARA  DTAARA(*LDA) VALUE(JOBENDP)
             RTVDTAARA  DTAARA(*LDA (30 10)) RTNVAR(&JOBNAME)

             CHGVAR     VAR(&IDNAM1) VALUE(&IDNAM)
             CHGVAR     VAR(&JOBNAME1) VALUE(&JOBNAME)

             IF         COND(&JOBNAME1 *EQ &IDNAM1) THEN(DO)
             ENDJOB     JOB(&JOBNAME) OPTION(*IMMED)
             ENDDO
  /*         DLTOVR     FILE(JOBENDP)        */
END:
ENDPGM

这个是编绎成功的,思路上基本符合我的要求了,可是   RTVDTAARA  DTAARA(*LDA (30 10)) RTNVAR(&JOBNAME)
(&JOBNAME)要么取不到值,要么取到不是我要的值。

麻烦指点下下。谢谢。

[ 本帖最后由 i400as 于 2008-12-8 22:56 编辑 ]

论坛徽章:
0
20 [报告]
发表于 2008-12-08 14:25 |只看该作者
dspfd  JOBENDP


看看它的RCDFMT 是什么?
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP