6.1ÓÃQCMDEXC±¸·ÝLIBRARYSµ½Ò»¸öFILEµÄ×ÓÀý³Ì
6.3.1 ÓÃAPI»ñÈ¡¹¤×÷Õ¾µÄIPµØÖ·£¨QDCRDEVD£©
C*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-==-
C* $Backup - Backup
the libraries/files from the system
C* SAVLIB LIB(LIBRARY) DEV(&DEVICE) ENDOPT(&REWIND)
C* SAVF(&SAVFLIB/&SAVF)
SAVACT(*LIB) ACCPTH(*YES)
C*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-==-
C $Backup Begsr
C*
C KeyName Setll BCKLIB03P
C KeyName Reade BCKLIB03P
C
Dow
Not%Eof(BCKLIB03P)
C*
C* save command always
use SAV command.
C*
C
Select
C
When
TYPE = '*LIB'
C
Eval SaveCmd = 'SAVLIB LIB('
C
When
TYPE = '*FIL'
C
Eval SaveCmd = 'SAVOBJ OBJ('
C
When
TYPE = '*DOC'
C
Eval SaveCmd = 'SAV'
C
Endsl
C*
C* SAVLIB LIB(JUNK) DEV(*SAVF) SAVF(JJFLIB/SAVF)
C*
C
Eval Device = 'DEV(' +
%Trim(TAPEDRIVE)
C
+ %Trim(')')
C
Eval EndOpt = %Trim('ENDOPT(')
C
+ %trim(ENDOFTAPE) + %Trim(')')
C*
C* write record for start of backup -
Start Date And Time
C*
C
If
Not%Open(BCKLIB04P)
C
Open
BCKLIB04P
C
Endif
C*
C
If
Not%Eof(BCKLIB03P)
C*
C
Time
SAVESTIME
C
Time
KeyTime
C
Move
*DATE
SAVESDATE
C
Move
*DATE
KeyDate
C
Write
BCK04R
C*
C
Endif
C*
C
If
%Open(BCKLIB04P)
C
Close
BCKLIB04P
C
Endif
C*
C
Eval CmdString = %Trim(SaveCmd) + %Trim('@@')
C
+ %Trim(OBJECT) + %Trim(')@')
C
+ %Trim(Device)+ %trim('@')+%Trim(EndOpt)
C
+ %Trim('@SAVACT(*LIB) ACCPTH(*YES)')
C*
C '@':' ' Xlate CmdString CmdString
C
Call
'QCMDEXC'
99
C
Parm
CmdString
C
Parm 256.
CmdLength
C*
C* write record for start of backup -
End Date And Time - Total run
C*
C Back04Key Klist
C
Kfld
LISTNAME
C
Kfld
OBJECT
C Kfld
KeyDate
C
Kfld
KeyTime
C*
C
If
Not%Open(BCKLIB04P)
C
Open
BCKLIB04P
C
Endif
C*
C Back04Key Chain BCKLIB04P
C
If
%Found(BCKLIB04P)
C
Time
SAVEETIME
C
Move
*DATE
SAVEEDATE
C*
C*DiffDays
= %Diff(ToISO:FromISO:*DAYS)
C*
C SAVEETIME Subdur SAVESTIME DiffSec:*S
C*
C
Eval RunHours
= (DiffSec/3600)
C
Eval RunMinutes = (DiffSec/60 - RunHours
* 60)
C
Eval RunSeconds
= (DiffSec -((RunHours * 3600)+
C
(RunMinutes * 60)))
C*
C
Exsr $LibInfo
C*
C
Update BCK04R
C
Endif
C*
C
If
%Open(BCKLIB04P)
C
Close
BCKLIB04P
C
Endif
C*
C KeyName Reade BCKLIB03P
C
Enddo
C*
C* if there is a program to run then
run it.
C*
C
If
ENDPGM <> *Blanks
C
Eval CmdString = 'CALL@@' + %Trim(ENDPGMLIB)
C
+ %Trim('/') + %Trim(ENDPGM)
C '@':' ' Xlate CmdString CmdString
C
Call
'QCMDEXC'
99
C
Parm
CmdString
C
Parm 256.
CmdLength
C
Endif
C*
C
Endsr
FRUSF
D PRMDTA
DS
D @PRDG1
1 5
D @PRDG2
6 10
D @LOW_MI_DSM
11 13
D @HIGH_MI_DSM
14 16
D @PRIME1
17 22
D @PRIME2
23 28
D @PRIME3
29 34
D @PRIME4
35 40
D @THANDLER
41 41
D @TMREP1
42 44
D @TMREP2
45 47
D SRLDA
E DS
EXTNAME(SRDLDA)
D XXFDAT
6 0
OVERLAY(LDUSR1:16)
D XXTDAT
6 0
OVERLAY(LDUSR1:22)
D
SDS
D PGMNAME
1 10
DINVDETL E
DS
EXTNAME(SROISDPL)
D ISO
S
D
D @FDATE
S
8 0
D @TDATE
S
8 0
C
EXSR
SQLOPEN
C EXSR GETDETAIL
C
EXSR
SQLCLOSE
C
MOVE
*ON
*INLR
C/EJECT
C GETDETAIL BEGSR
* Read selected
invoice detail records
C
EXSR
GET
C SQLCOD
DOWEQ 0
C
IF
IDAMOU <> 0
C
CLEAR
TYPE
C
SELECT
C
WHEN
IDCCA1 = @PRIME1 OR IDCCA1 = @PRIME2 OR
C
IDCCA1 = @PRIME3 OR IDCCA1 = @PRIME4
C
EVAL
TYPE = '2'
C
WHEN
%SUBST(IDHAND:1:1) <> @THANDLER AND
C
IDSALE >= @LOW_MI_DSM AND
C
%SUBST(IDSALE:1:1) <> %SUBST(@TMREP1:1:1)
C
EVAL
TYPE = '3'
C
WHEN
%SUBST(IDHAND:1:1) = @THANDLER AND
C
IDSALE >= @LOW_MI_DSM AND
C
%SUBST(IDSALE:1:1) <> %SUBST(@TMREP1:1:1)
C
EVAL
TYPE = '4'
C
WHEN
%SUBST(IDHAND:1:1) = @THANDLER AND
C
IDSALE >= @TMREP1 AND IDSALE <= @TMREP2
C
EVAL
TYPE = '5'
C
ENDSL
* Reverse credit
memo amount
C
IF
IDTYPP = 2
C
EVAL
IDQTY =
IDQTY * -1
C
EVAL
IDAMOU = IDAMOU * -1
C
END
C
WRITE R
C
ENDIF
C
EXSR
GET
C
ENDDO
C
ENDSR
C/EJECT
C *INZSR
BEGSR
C *DTAARA
DEFINE *LDA
SRLDA
C
IN
SRLDA
* Convert
entered date range to CCYYMMD and report headings
C *MDY
MOVE
XXFDAT ISO
C
MOVE ISO
@FDATE
C *MDY
MOVE
XXTDAT ISO
C
MOVE
ISO
@TDATE
C KEY
KLIST
C
KFLD
PRMTYP
C
KFLD
PSARCH
C
EVAL
PRMTYP = 'RPGPGM'
C
EVAL
PSARCH = PGMNAME
* Get parameter
definition record
C KEY
CHAIN
XABCTLPM
C
ENDSR
C/EJECT
C SQLOPEN BEGSR
* Execute SQL
prepare and open statement
C/EXEC SQL
C+ DECLARE A CURSOR
FOR
C+ SELECT *
C+ FROM SR3ISD
C+ WHERE IDIDAT BETWEEN :@FDATE AND
:@TDATE AND
C+ IDPGRP
BETWEEN :@PRDG1 AND :@PRDG2 AND
C+
IDSALE <= :@HIGH_MI_DSM
AND
C+
IDFOCC <> 'Y'
C/END-EXEC
C/EXEC SQL
C+ OPEN A
C/END-EXEC
C
ENDSR
C/EJECT
C GET
BEGSR
* Get invoice
detail records using dealer cursor
C/EXEC SQL
C+ FETCH A INTO
:INVDETL
C/END-EXEC
C
ENDSR
C/EJECT
C SQLCLOSE BEGSR
* Execute close
of cursor
C/EXEC SQL
C+ CLOSE A
C/END-EXEC
C
ENDSR
C/EJECT
1£®2 SUBFILES
AND DATA QUEUES
¡ªA PERFECT COMBINATION
* ¸Ã²¿·ÖµÄÄÚÈÝÀ´×ÔÒ»·Ý²»ÍêÕûµÄPDFÓ¢ÎÄÎĵµ£¬¹ØÓÚdata queueºÍsubfile½áºÏµÄÓ¦ÓÃͦÉÙ¼ûµÄ£¬²»¹ýÎÒ¾õµÃºÜʵÔÚ£¨ÒòΪǰ¶Îʱ¼ä¸ÕºÃÓöµ½ÕâÑùµÄÇé¿ö£¬ÓÃdata queue½áºÏsubfile¿ÉÒÔºÜÈÝÒ×°ïÎÒ½â¾öÎÊÌ⣩¡£ÓÈÆäÊÇÓÐʱºòΪÁËÌá¸ß³ÌÐòµÄËٶȣ¬Ê¹Óà a page-at-timeµÄÓ÷¨£¬´¦ÀíÓû§pagesown/upµÄ²Ù×÷»á·Ç³£¼òµ¥¡£Àý×ÓÖÐÖ»ÊÇΪÁËÓÃdata queue´æ´¢Óû§µÄ²Ù×÷ÐÅÏ¢£¬»ÃæµÄrecords¶¼ÊÇÖ±½Ó´Ódata
file¶ÁÈ¡¡£¸öÈËÈÏΪ£¬ÕâÑùÓÃÓеãСÌâ´ó×öÁË£¬µ«ÊÇ£¬Èç¹ûʵ¼ÊµÄÔËÓÃÖУ¬Ò»¸ö»ÃæÉϵÄÊý¾Ý²»ÄÜÖ±½Ó´ÓÊý¾Ý¿âÎļþÖжÁÈ¡£¬¶øÊÇÒª¾¹ý´óÁ¿µÄÊý¾Ý´¦ÀíµÄʱºò£¬¿ÉÒÔÓÃdata
queue´æ´¢Õû¸ö»ÃæµÄÐÅÏ¢¡£PageupµÄ´¦Àí¾Í±äµÃ·Ç³£¼òµ¥ÁË¡£
ÏÂÃæµÄÀý×ÓÖнéÉÜÁËÒ»ÖÖÀàËÆAS/400ÉϵÄPDM¹¤¾ßµÄsubfileµÄÓ¦Óá£ÓùýPDM¹¤¾ßÖ®ºó£¬Äã»á¾õµÃËüÊÇÒ»¸ö·Ç³£¿áµÄSubfileÓ¦Ó㬷dz£Áé»î¡£Äã¿ÉÒ԰ѹâ±ê¶¨Î»ÔÚsubfile»ÃæµÄÈκÎλÖÃ,ÒÔÕâ¸öλÖõÄÊý¾Ý×öΪһ¸öÆðµãÉÏÏ·ҳ£¬ÔÚÈκÎÒ³ÃæµÄsubfileÉϸü¸ÄÀ¸Î»Öµ£¬ÔÚ°´ÏÂenter¼üµÄʱºò£¬ËùÓÐÓû§×ö¹ýµÄ¸Ä¶¯¶¼½«±»´¦Àí¡£Ã¿¸öÌØÐÔ¶¼¿ÉÒÔ¼òµ¥µÄͨ¹ýrpgµÄsubfileÓ¦ÓÃÀ´ÊµÏÖ¡£µ«Ö»Óн«ËûÃǶ¼ÁªºÏÆðÀ´Ó¦ÓòŻáÈç´ËÁé»î¡£
ÏÂÃæÊǵäÐ͵ÄPDM»Ãæ
Work with Members Using PDM
File . . . . . . QRPGLESRC
Library . . . . SRCA
Position to . . . . .
Type
options, press Enter.
2=Edit
3=Copy 4=Delete
5=Display
6=Print
7=Rename
8=Display description 9=Save 13=Change text 14=Compile 15=Create module..
Opt Member Type
Text
S3I13VR2 RPGLE SK-Inq of Prod. Schedule (13V DVLP) <A Apr> Phu
S
S3R13VR2 RPGLE
SK-Production Schedule (13V) (Developing) KHu
TAADBFCR RPGLE Create
print pgm - Call by TAADBFCC2
TAADBFCR2 RPGLE Display DB
def - Call by TAADBFCC4
TAADBFCR3 RPGLE PRTDBF
command 1st of 3 source skel
TAADBFCR4 RPGLE PRTDBF
command 2nd of 3 source skel
TAARPGAR RPGLE Binary
search in RPG sample - Call by TAARPGAC
More...
Parameters
or command
===>
F3=Exit
F4=Prompt
F5=Refresh
F6=Create
F9=Retrieve F10=Command
entry F23=More
options
F24=More keys
µ±È»£¬Èç¹ûÄã³ýÁË»áÓÃRPGLE,»¹¶ÔUIMºÜÊìϤµÄ»°£¬PDMÕâÑùµÄ¹¦ÄÜÊǺÜÈÝÒ×ʵÏֵġ£µ«ÊÇ£¬Èç¹ûÎÒÃDz»ÖªµÀUIMÄØ£¿£¨ºÇºÇ£¬ÖÁÉÙÎÒĿǰΪֹ»¹Ã»Ñ§¹ýÈκÎUIMµÄÓ÷¨£¬Ö»¿´µ½¹ýһЩÑùÀý´úÂë¡£ËƺõºÜÉËÄÔ½îµÄ˵¡££©Ã»ÎÊÌ⣬ÎÒÃÇÏÈÁ˽âÒ»ÏÂdata queue£¬ÀûÓÃËüºÍsubfileµÄÍêÃÀ½áºÏ£¬ÎÒÃÇÒ²ÄÜʵÏÖPDMµÄËùÓÐÁé»îÌØÐÔ¡£
¹ØÓÚDATA QUEUE
Data
queues ÊÇas/400ϵͳµÄÒ»ÖÖ¶ÔÏóÀàÐÍ£¨*DTAQ£©£¬Äã¿ÉÒÔÓÃOS/400µÄÃüÁîºÍAPIÀ´´´½¨Î¬»¤¡£ÕâÖÖÀàÐ͵ĶÔÏóÓÃÀ´·¢ËͽÓÊÕ¶à¸ö¼Ç¼£¬¾ÍÏñÊý¾Ý×é³ÉµÄ×Ö·û´®Ò»Ñù¡£Data
queueÖеÄÊý¾Ý¿ÉÒÔ±»¶à¸ö³ÌÐò£¬Óû§»ò¹¤×÷À´·¢ËͺͽÓÊÕ£¬ÕâÖлúÖƶÔÊý¾Ý¹²ÏíºÜÓÐÓã¬ÒòΪËü±ÈÊý¾Ý¿âÎļþ£¨database fiels£©£¬ÏûÏ¢¶ÓÁÐ(message queues)»òÕßdata areaÕ¼ÓõÄϵͳ×ÊÔ´¶¼ÒªÉÙ£¬Òò´Ë¿ÉÒÔ×öΪÁ½¸öjob¼äµÄ·Çͬ²½Í¨ÐŵÄÒ»ÖÖ·½·¨¡£Data queues¿ÉÒÔ½«Ã»¸ö·¢ËÍÊý¾ÝÕߵıêʶ£¨sender ID£©Ò»Æð±£´æÔÚÆäÖС£·¢ËÍÊý¾ÝÕß±êʶÊǵ±data
queue±»´´½¨µÄʱºòµÄÒ»¸öÊôÐÔ£¬ÆäÖаüº¬Á˸ÃjobµÄÃû×ֺ͵±Ç°Óû§ÃèÊöÎĵµÐÅÏ¢¡£Data queueµÄÁíÍâÒ»¸öºÃ´¦ÊÇ¿ÉÒÔÉèÖÃÒ»¸öjob´ÓÖжÁдÊý¾ÝµÄµÈ´ýʱ¼ä¡£µÈ´ýʱ¼ä¿ÉÒÔÉèÖóÉ0~99£¬999£¬µ¥Î»ÎªÃë¡£Èç¹û¸Ã²ÎÊýÉèÖÃΪ¸ºÊý¾Í±íʾÕâ¸öjob»áÎÞÏÞÖƵĵȴýÍê³ÉÒ»´ÎÊý¾Ý´«ËͲŻá¼ÌÐøÏÂÒ»²½µÄ²Ù×÷¡£
HLL(High-level language)³ÌÐò¿ÉÒÔʹÓÃQSNDDTAQºÍQRCVDTAQÀ´·¢ËͺͽÓÊÕÊý¾Ý¡£´Ódata
queue¶ÁÈëÊý¾ÝµÄ˳Ðò¿ÉÒÔÊÇÏÈÈëÏȳö FIFO,»òÕߺóÈëÏȳö LIFO£¬»òÕß°´Õչؼü×ֶεÄË÷Òý˳Ðò£¨keyed data queue£©¡£Òª½¨Á¢ÆðPDMµÄsubfileÓ¦Ó㬾ÍÐèҪʹÓð´Õչؼü×ֶεÄË÷Òý˳Ðò(keyed data queue),ÕâÑù¾ÍÔÊÐí³ÌÐò´Ódata
queue¶Á³öÖ¸¶¨µÄij´ÎÌض¨µÄÊý¾ÝÊäÈë¡£±ÈÈçÎÒÃÇ¿ÉÒÔ´Ódata queueÖжÁÈ¡µÈÓÚ£¬»ò´óÓÚ£¬»ò´óÓÚµÈÓÚij¸ö¹Ø¼ü×Ö¶ÎÖµµÄij´ÎÊý¾ÝÊäÈë¡£
ÁªºÏdata queue ºÍsubfileµÄ¹¦ÄÜ£¬¿ÉÒÔΪÓû§Ìṩ×îÓÐЧÁé»îµÄ½â¾ö·½·¨¡£
±¾ÀýÖÐʹÓÃa page-at-timeÀ´µ÷ÓÃsubfile,¼´£ºsflpag=sflsiz£¬ÕâÑù£¬Óû§×îºó¹â±ê¶¨Î»µÄµØ·½¾Í¿ÉÒÔ×÷ΪÏÂÒ»¸öÒ³ÃæµÄ¿ªÊ¼£¨move
by cursor position£©,¾ÍÏñÎÒÃÇÓÃSEUµÄʱºò£¬shift+f1,ÔÚÏÂÃæµÄ²ÎÊý
Amount to roll . . . . . . . . . . . C
H=Half, F=Full
C=Cursor, D=Data
1-999
ÌîÈëCµÄʱºòËù´ïµ½µÄЧ¹û¡£
ÎÒÃÇ»¹Ï£ÍûÓû§ÔÚÿ¸öÒ³Ãæ×öµÄ¸Ä¶¯¶¼±»¼Ç¼ÏÂÀ´£¬Ö±µ½°´ÏÂENTER¼ü£¬ÔÙµ÷ÓÃÏà¹Ø´¦Àí¹ý³Ì¡£Ê¹ÓÃdata queue,ÄܱÈdata structure,files,arraysÌṩ¸ü¶àµÄÁé»îÓ¦Ó᣽»»¥Ê½µÄ×÷ÒµÖУ¬data queue APIµÄÏìӦʱ¼ä¸ü¿ì£¬Õ¼ÓõÄϵͳ×ÊÔ´Ò²¸üÉÙ£¬Ìá¸ß³ÌÐòµÄÐÔÄÜ¡£µ±ÄãʹÓÃQRCVDTAQÃüÁî½ÓÊÕÊý¾ÝµÄͬʱ£¬ÕâЩÊý¾ÝÒ²±»´Ódata
queueÖÐ×Ô¶¯É¾³ý¡£
³ÌÐò´úÂë·ÖÎö
CL: Ò»°ã³ÌÐò±»µ÷ÓõÄʱºò£¬¶¼»áÏÈɾ³ýµôdata queue,È»ºóÖØд´½¨Ò»¸ö£¬¼´Ê¹ÄãÊÇ´´½¨ÔÚqtempÀïÃæ¡£Ê×ÏÈ£¬É¾µôdata
queueÊÇΪÁË·ÀÖ¹¶à´Îµ÷ÓóÌÐò£¬data queueµÄÈÝÁ¿±ä´ó£¬Õ¼Óÿռ䡣ÔÚqtempÖд´½¨£¬¿ÉÒÔʹµÃ¸÷¸öjobµÄÓû§²Ù×÷ÐÅÏ¢¶ÀÁ¢·Ö¿ª¡£µ±È»Èç¹ûÄãÒª¿ª·¢ÒÔÒ»¸öjob¼äͨÐŵÄÓ¦Ó㬾ÍÊÇÁíÍâÒ»»ØÊÂÁË¡£
/*============================================================*/
/* To compile: */
/* */
/* CRTCLPGM PGM(XXX/SFL011CL)
SRCFILE(XXX/QCLLESRC) */
/* */
/*============================================================*/
PGM
DLTDTAQ DTAQ(QTEMP/SFL011DQ)
MONMSG MSGID(CPF2105)
CRTDTAQ DTAQ(QTEMP/SFL011DQ)
MAXLEN(256) SEQ(*KEYED) +
KEYLEN(7)
CALL PGM(*LIBL/SFL011RG)
ENDPGM
DDS:
Ö»ÐèÒªÖ¸¶¨SFLPAGµÄÖµºÍSFLSIZÒ»Ñù¾Í¿ÉÒÔÁË¡£Ã¿´ÎдÈëµ½SFLµÄRECORDÊý²»³¬¹ýSFLPAG.
RPGLE:
* * Load
data to subfile * C
do sflpag C
read
sfl001lf
90 C
if *in90 C
leave C
endif * C
eval option = *blanks C
exsr rcvque C
eval rrnl = rrnl + 1 C
if rrnl = 1 C
eval savlnan = dblnam C
eval savfnan = dbfnam C
endif C
write sfl1 C
eval *in74 = *off C
enddo
Figure 7.2: Loading the subfile with one page of records.
×¢Òâÿ´Î´ÓÊý¾ÝÎĵ±ÖжÁÈ¡Êý¾Ý֮ǰ£¬¶¼»áÖ´ÐÐÒ»´ÎRCVQUE×Ó³ÌÐò¡£»Ãæ³õʼÔØÈëµÄ¹ý³ÌÖУ¬Õâ¸ö×Ó³ÌÐò×ö²»ÁËʲôÊÂÇ飬µ«ÊÇ£¬Ö®ºó£¬Óû§¸Ä±äSubfileµÄ¼Ç¼£¬²¢ÇÒ°´ÏÂpagedown/pageup×ö¸ü¶à¸Ä¶¯µÄʱºò£¬Ëü¾Í±äµÃºÜÖØÒªÁË¡£ÒòΪÎÒÃÇÏëÒªÔÚÓû§µÚ¶þ´Î»Øµ½Ò»¸ö»ÃæµÄʱºò£¬Óû§ÖµÇ°ÔڸûÃæÉϵĸĶ¯ÒÀÈ»ÄÜÌåÏÖ³öÀ´¡£ADDQUE×Ó³ÌÐòÊǵ±Óû§Ö´ÐÐÈκÎÓÐЧµÄ¹¦ÄܼüµÄʱºò£¬¼Ç¼ÏÂÓû§ÔÚsubfileÉ϶ԼǼ×öµÄÐ޸ģ¬ÀûÓÃQSNDDTAQ½«ËûÃÇдÈëµ½data
queueÖС£
Figure 7.3: Each time a valid function key, other than F3 or F12, is
pressed, the changed records are added to the data
queue.
Table 7.1 ÏÔʾÁË0QSNDDTAQ
µÄ²ÎÊýÁбí
Figure 7.4 ÏÔʾÁ˵±Óû§ÔÚij¸ösubfile¼Ç¼ǰÃæÊäÈëÑ¡Ïî4£¬È»ºóÓÖ°´ÏÂÁËpagedownµÄʱºòдÈëµ½data queueµÄÄÚÈÝ
°üÀ¨Ñ¡Ï飨4£©£¬DBIDNMµÄÖµ£¨ËüÊÇÊý¾Ý¿âÎļþµÄ¹Ø¼ü×Ö£¬Ò²ÊÇDATA
QUEUEµÄ¹Ø¼ü×Ö£©£¬ÒÔ¼°Ò»¸ösubfileµÄÒþº¬À¸Î»¡£
Figure 7.4: The contents of the data queue
after the user places a
presses the page-down key.
ADDQUE×Ó³ÌÐò¸ú×ÙËùÓÐsubfileÖиü¸Ã¹ýµÄ¼Ç¼¡£ÀýÈ磺Óû§ÔÚµ±Ç°»ÃæÉϵÄij¸ö¼Ç¼ǰÃæÊäÈë4×¼±¸ÒªÉ¾³ýËü£¬Í¬Ê±»¹Ïëɾ³ýϸö»ÃæÉϵÄÁ½±Ê¼Ç¼¡£ÕâÑù£¬ÔÚÏÔʾ¸øÓû§ÏÂÒ»¸ö»Ãæ֮ǰ£¬ADDQUE°Ñ»ÃæµÄ²Ù×÷ÐÅϢдÈëdata
queue,ÔÚÓû§ÔÚÕâÁ½¸ö»ÃæÉϹ²Ñ¡¶¨ÁË3±Ê¼Ç¼֮ºó£¬°´ÏÂenter¼ü£¬Õâʱºò£¬data queueÖй²ÓÃÈý±ÊÊäÈ롣ͬÑù£¬µ±Óû§Òª¶¨Î»µ½subfileµÄijһ±Ê¼Ç¼µÄʱºò£¬Ò²»áÔÚdata queueÖÐдÈëÓû§²Ù×÷µÄÐÅÏ¢¡£
Figure 7.5: This routine writes the
changed records to the data queue.
ÏÖÔÚÈÃÎÒÃÇ¿´¿´RCVQUEµÄÏêϸÄÚÈÝ¡£.
Figure 7.6: This routine removes entries
from the data queue.
Figure 7.6: This routine removes entries
from the data queue (continued).
¸Ã×Ó³ÌÐòÓÃQRCVDTAQ´ÓÊý¾Ý¿âÎļþ¶ÁÈ¡µÄ¹Ø¼ü×ÖDBIDNM´Ódata
queueÖлñµÃÒ»±ÊÊäÈëµÄÐÅÏ¢¡£Âß¼¹ØϵÉèÖÃΪ¡°ÏàµÈ¡±£¨EQ£©¡£È»ºó£¬ÉèÖÃָʾÆ÷*IN74£¨SFLNXTCHG£©×´Ì¬Î»¡®1¡¯£¬µ±subfile±»Ð´Èë¼Ç¼µÄʱºò£¬±êʶ¸Ã»ÃæΪ¡°ÒѸü¸Ä¡±¡£ÏÂÒ»´Î¸ÃÒ³ÃæÏÔʾµÄʱºò¾Í¿ÉÒÔÓÃREADCÀ´ÕÒµ½¶ÔÓ¦Óû§Óùý²Ù×÷µÄ¼Ç¼ÁË¡£
Table 7.2 ÏÔʾÁËQRCVDTAQµÄ²ÎÊýÁбí
ͼ7.7 ÏÔʾÁËRCVQUE×Ó³ÌÐòÖе÷Óà API QRCVDTAQ µÄÓ¦Óá£
¸ÃAPIÒ»Ö±ÔËÐе½±äÁ¿LEN=0,Õâ¸öʱºò±íʾdata queueÖÐËùÓд洢µÄÊý¾ÝÐÅÏ¢¶¼ÒѾ±»¶Á³öÀ´ÁË¡£
Íê³ÉµÄÔ´´úÂ룺
SFL011CL: CL
Program to Create the Temporary Data Queue
/*============================================================*/
/* To compile: */
/* */
/* CRTCLPGM PGM(XXX/SFL011CL)
SRCFILE(XXX/QCLLESRC) */
/* */
/*============================================================*/
PGM
DLTDTAQ DTAQ(QTEMP/SFL011DQ)
MONMSG MSGID(CPF2105)
CRTDTAQ DTAQ(QTEMP/SFL011DQ)
MAXLEN(256) SEQ(*KEYED) +
KEYLEN(7)
CALL PGM(*LIBL/SFL011RG)
ENDPGM
SFL011DF: DDS
Using the Data Queue Technique
A
DSPSIZ(24 80 *DS3)
A
PRINT
A ERRSFL
A CA03
A CA12
A*
A
R SFL1 SFL
A*
A 74
SFLNXTCHG
A
DBIDNM R
H
REFFLD(PFR/DBIDNM *LIBL/SFL001PF)
A
OPTINO
A
DBLNAM R O
10 7REFFLD(PFR/DBLNAM
*LIBL/SFL001PF)
A
DBFNAM R O
10 31REFFLD(PFR/DBFNAM
*LIBL/SFL001PF)
A
DBMINI
R
O 10 55REFFLD(PFR/DBMINI *LIBL/SFL001PF)
A
DBNNAM R O
10 60REFFLD(PFR/DBNNAM
*LIBL/SFL001PF)
A
R SF1CTL
SFLCTL(SFL1)
A*
A
CF06
A
SFLSIZ(0012)
A
SFLPAG(0012)
A
ROLLUP
A
ROLLDOWN
A
OVERLAY
A N32
SFLDSP
A N31
SFLDSPCTL
A 31
SFLCLR
A 90
SFLEND(*MORE)
A
RRN1 45
OH
SFLRCDNBR
A
9
A
DSPATR(HI)
A
9
*
* To compile:
*
* CRTRPGPGM PGM(XXX/SFL011RG)
SRCFILE(XXX/QRPGLESRC)
*
*=======================================================================
¹ØÓÚAPIµÄÓ¦Óã¬www.code400.comÉÏÃæÓкܶàÀý×Ó¡£¾ßÌåµÄÁ´½ÓµØÖ·ÊÇ£ºhttp://www.code400.com/viewsamples.php?lang_id=10
sample program: RTVIPADR
H NOMAIN
*****************************************************************
* RTVIPADR -
Retrieve the IP address of a display device
*
* Uses QDCRDEVD
API
*
*****************************************************************
D
D* Prototype
D RtvIPAdr
PR
15
D DeviceNm
10 Value
D
*****************************************************************
* RtvIPAdR function
*****************************************************************
P RtvIPAdr
B
Export
D
D RtvIPAdr PI
15
D DeviceNm
10 Value
D* Declare variables
for calling QDCRDEVD API
D Err
S
15
D DevType
S
8 Inz('DEVD0600')
D DataLen
S
4B 0 Inz(971)
D Data
S
971
D
D* Data structure for
error info
D ErrorDS
DS
D ErrLen
1 4B
0 Inz(15)
D ErrID
9 15
D
D* receiver field for
IP address
D IPAddr
S
15
D
C* Call the QDCRDEVD
API
C
Call
'QDCRDEVD'
C
Parm
Data
C
Parm
DataLen
C
Parm
DevType
C
Parm
DeviceNm
C
Parm
Err
C
C* Move error info
into Data Structure
C
Eval ErrorDS = Err
C
C* If error found then
return "ERROR" otherwise return IP address
C
If
ErrID <> *blanks
C
Eval IPAddr = 'ERROR'
C
Else
C* Pull out the IP
address
C
Eval IPAddr = %subst(Data:878:15)
C
Endif
C
C* Return the IP
address to the calling pgm
C
Return IPAddr
P
E
Ëü¿ÉÒÔÓÃÀ´»ñµÃÈκÎÍøÂçÉ豸µÄIPµØÖ·¡£¸ÃÀýÖÐÖ»ÓÃÀ´»ñµÃÒ»¸ö¹¤×÷Õ¾µÄIP.
ʹÓÃQDCRDEVD APIµÄʱºòÎÒÃÇҪעÒâµ½ËüµÄ¼¸¸öÏÞÖÆ£º
1.É豸Ãû±ØÐ붼ÊÇ´óд(QPADEV0001, ¶ø²»ÊÇ
qapdev0001).Èç¹ûÄã´«µÝµÄ²ÎÊýÊÇСд£¬Ëü»á·µ»ØÒ»¸ö´íÎó¡£
2.Èç¹ûÉ豸ÊÇͨ¹ýpass-through (STRPASTHR)·½Ê½Á¬½ÓµÄ£¬QDCRDEVD¾Í²»ÊÊÓÃÁË¡£3.ËüÒ²²»ÄÜÓÃÓÚÖ»µ÷ÓÃRPG/CLµÄPC¹¤×÷¡£
¸ü¶à¹ØÓÚQDCRDEVDµÄÐÅÏ¢¿ÉÒÔÔÚIBM information centreÕÒµ½¡£