(590) Upload data from PC database to AS400
Notes: An additional license is required to enable QMirror/DB upload functions.
QMirror/DB provides a convenient and safe method for writing data back to the AS400 server from the PC database based on transactional management.
Only defined upload fields will be written back to the AS400 server, and these fields will be restricted to download from the AS400 server to the PC database during the replication. That means you should not update the fields on the AS400 which are defined as the upload fields in table QMIRROR.ZUPFLD.
A CL program UPCLIB/UPCPGM will be called right after the upload succeeded. Refer to (A100) Upload controller (ZUPCTL).
To write data back to the AS400 server from the PC database:
1. The table must be journaled and well downloaded to the PC database
2. Define upload fields in system table QMIRROR.ZUPFLD
Use SQL command for rapid insertion:
INSERT INTO QMIRROR.ZUPFLD (UPLIB, UPFILE, UPFLDI, UPFTXT) SELECT WHLIB, WHFILE, WHFLDI, WHFTXT FROM QMIRROR.ZWHFLD WHERE WHLIB=’LIBR1′ AND WHFILE=’FILEA’
Refer to (A120) Upload fields master (ZUPFLD).
3. Maintain upload fields’ value on the PC database by PC applications
4. Request QMirror/DB to write data back based on transactions by inserting changed records into system table QMIRROR.ZUPDTL
INSERT INTO QMIRROR.ZUPDTL (UPTMST, UPTRXN, UPLIB, UPOBJ, UPMBR, UPCODE, UPRRN) VALUES (<current date>, <current time> ,’POCFM’, ‘LIBR1’, ‘FILEA’, ‘FILEA’, ‘U’, 425);
Refer to (A110) Upload transaction detail (ZUPDTL).
5. Insert transaction controller into system table QMIRROR.ZUPCTL to start upload
INSERT INTO QMIRROR.ZUPCTL (UPTMST, UPTRXN, UPCLIB, UPCPGM, UPRMRK) VALUES (<current date>, <current time>, ‘POCFM’, ’LIBR1’, ’POPGM2’, ‘PO Confirmation’)
Refer to (A110) Upload transaction detail (ZUPDTL).
6. Check upload return code
0000 – Success
0001 – Fields definition error in ZUPFLD
0002 – Record missing on PC database
0003 – Record missing on AS400 server
0004 – Record insertion error
0005 – Record updating error
0006 – Table not journaled or well downloaded
0008 – CL program failure
9999 – Unknown error