Sponsors
Search
Link to our site
Learning Resources
NETPPE Net Post processing Exit Submit Job. Submitted by Poul Aschenbrenner. Email: pas (at) coop dot dk NETPPE is a program that automatically submits a job when stream file is received in IFS. It uses standard function in IBM i that is called QIBM_QPWFS_FILE_SERV Exit Point. When using a file share, windows and other OS can send files to IBM i. System is using 1 RPG Free Format program and 2 CL programs. There is a database file that has entry for comparing with the received files. When a file existed in the database it copy the stream file to QTEMP and then submit a specific program. Program name and all the option for submitting is entered in the database file. The database file has the following entry: CHKFILE 32A File to check for CHKUSER 10A User to Check for RCDLEN 5 0 Record length of the file SBMUSER 10A Submit User name SBMPGM 10A Submit Program name SBMLIB 10A Submit Library name JOBDLIB 10A Job description File Library JOBDFILE 10A Job description File JOBQLIB 10A Job Queue Library JOBQ 10A Job Queue COMMENT 50A Comment Text for the record Program NETPPE is starting program from QIBM_QPWFS_FILE Exit Point. Then it called the CL program NETPPECL. NETPPECL submit every new file to a program named NETPPECALL. Before you compile the programs you should change the CL program named NETPPECALL. Under /* Copy Received Stream File to QTEMP */ CPYFRMSTMF FROMSTMF(&PFILE) + TOMBR('/QSYS.LIB/QTEMP.LIB/NETPPE.FILE/NETP+ PE.MBR') MBROPT(*REPLACE) CVTDTA(*TBL) + TBL('/QSYS.LIB/QGPL.LIB/A2521142.TBL') There is a table that should fit your language translation table. If you are using English code page you could use it with out the translation table. Then remove CVTDTA and TBL parameters. In Conversion table TBL parameter you specify the path name of the conversion table to be used to convert data from the stream file to the database file member. My translation table is a table that is converting from Windows, Latin 1 to T1001142 Denmark, Norway ECECP 1142 EBCDIC. Every time a file is received in IFS it sends a message to QHST. And when program is submitted it sends a message to QSYSOPR. You could change the programs to add a log in a database or do what ever you desired. Adding Exit point to QIBM_QPWFS_FILE_SERV. When adding the exit point you do this with command WRKREGINF. Use page down to you find: QIBM_QPWFS_FILE_SERV PWFS0100 *YES File Server Under option you use 8=Work with exit programs. Use then 1=Add to add the exit point program. Remember to compile programs before you add the exit point. In the Exit Program you write NETPPE and in the Library you write library you have placed the program in. Normal I have placed it in QGPL. Read more about Exit Point and File Share in the manual: http://publib.boulder.ibm.com/infocenter/iseries/v5r3/topic/rzaii/rzaiimstexfile.htm Note: ? For the file server, the exit program name is resolved when the QSERVER subsystem is activated. If you change the program name, you must end and restart the subsystem for the change to take effect. ? If the file server exit program swaps to another user and does not swap back to the original user, the file server session continues to operate with the user that originally connected to the session. This is because the host file server and iSeries(TM) NetServer(TM) get credential information for the user who did the initial connection to the session and uses this credential information when doing client requests. With the host file server and iSeries NetServer using the credential information, any swapping of the user profile in the file server exit program is not used by the file server for file system operations. Haw to create a new file share by using iSeries Navigator. To create a new file share by using iSeries Navigator, follow these steps: 1. Open iSeries Navigator and connect to the system you want to work with. 2. Expand Network. 3. Expand Servers. 4. Click TCP/IP to retrieve a list of TCP/IP servers available. 5. Right-click iSeries NetServer and select Open. 6. Right-click Shared Objects and select New and then File. 7. Use the General Properties page to configure the new file share with a name, description, access, maximum number of users, and directory path name. 8. Use the Text Conversion page to identify which file types will have their contents converted from the iSeries file coded character set ID to the coded character set ID you specify for the share. Note: The iSeries Navigator online help provides more details about iSeries NetServer file share properties. Until now, NetServer could only be managed by IBM's Operations Navigator, a slow and cumbersome PC resource hog. NetServer ToolKit is a free software package from ariadne that lets you manage NetServer using a simple, convenient and reliable green-screen interface. NetServer ToolKit provides simple commands to create, change, delete and display File and Print Shares, display and change NetServer attributes, start and end NetServer jobs etc. Try NetServer ToolKit at http://www.systemi.co.uk/ Haw to connect from Windows to IBM i File Server system. Windows and other OS system using File Share can connect to IBM i and send stream files to IFS on IBM i. This is done from windows with following commands. NET USE Q: \\system_name\ifs_folder_name password /USER:user This command creates a connection to the specified file share. And then you can send files to the file share. You are ready to copy your files to IBM i file share. For every file you copy the NETPPE program starts and check that there is a program that should run for that file. COPY filename.ext Q: After you have copy the files to the file share you can close connection with the following command. NET USE Q: /DELETE V6R1 QIBM_QPWFS_FILE_SERV Exit point changes The definition for exit point QIBM_QPWFS_FILE_SERV will be different when V6R1 is installed over an earlier release. When an exit program is added or removed for the exit point, a reprocessing program will require the user doing the add or remove operation to have *ALLOBJ and *SECADM special authorities. The Allow change parameter will be set to *NO which means the user will not be able to change the exit point definition. If a user had been changing the exit point definition in earlier releases, they will not be able to do so in V6R1. In V6R1, users who could not retrieve the path name to pass to the exit program registered for exit point QIBM_QPWFS_FILE_SERV will be able to retrieve the path name. NETPPE RPG Free Format Program ************************************************************ * Program : NETPPE Net Post processing Exit Submit Job. * * This program will start when a file is recieved * * in IFS file share. * * CL program NETPPECL is Called when file match * * NETPPE Exit point registered to QIBM_QPWFS_FILE_SERV * * (C) Poul Aschenbrenner, COOP IT * ************************************************************ FNETPPEDB IF E DISK * Prototype for Call CL program D NETPPECL PR ExtPgm('NETPPECL') D CSBMLIB 10A D CSBMPGM 10A D CJOBDFILE 10A D CJOBDLIB 10A D CJOBQ 10A D CJOBQLIB 10A D CSBMUSER 10A D CRCDLEN 5 0 D CFILE 32A * Prodecure to send message D QMHSNDM PR ExtPgm('QMHSNDM') D MsgID 7A const D QualMsgF 20A const D MsgTxt 32767A const options(*varsize) D MsgTxtLen 10I 0 const D MsgType 10A const D MsgQueues 20A const dim(50) options(*varsize) D NumQueues 10I 0 const D RpyQueue 20A const D MsgKey 4A D errcode * const D messageid s 7a INZ('CPF9898') D msgfilnm s 20a INZ('QCPFMSG *LIBL ') D messagekey s 4a INZ(' ') D msgq s 20a INZ('QHST *LIBL ') D rply s 20a INZ('QHST *LIBL ') D msg s 256a VARYING D PWFS0100 ds qualified D User_Profile 10a D Server_Id 10a D Function_ID 10u 0 D Format_Name 8a D RD_Open 1a D WR_Open 1a D RD_WR_Open 1a D Delete_Allow 1a D Filename_Len 10u 0 D Filename 16383c CCSID(1200) D MyFile S 32a varying D pFile S 32a D ChkFileLen S 4P 0 D HexNullPos S 10I 0 * Parameter for NETPPE Dprm PR extpgm('NETPPE') D RTNCD 1A D PCSDTA 9999A Dprm PI D RTNCD 1A D PCSDTA 9999A /Free RTNCD = '1'; PWFS0100 = PCSDTA; // Check for Server id *FILESRV If PWFS0100.Server_Id = '*FILESRV '; // Check for Create New File If PWFS0100.Function_ID = X'00000001'; ChkFileLen = PWFS0100.Filename_Len / 2; MyFile = %subst( PWFS0100.Filename : 1 : ChkFileLen ); // Send message to QHST msg = 'NETPPE: File Recieved in IFS : ' + %Trim(MyFile); CALLP QMHSNDM( messageid : msgfilnm : msg : %len(msg) : '*INFO' : msgq : 1 : rply : messagekey : *null ); // Read all files to check for Read NETPPEDB; DoU %eof(NETPPEDB); ChkFileLen = %len(%trim(CHKFILE)); If %subst(MYFile : 1 : ChkFileLen) = CHKFILE; // Check NET user. If PWFS0100.User_Profile = CHKUSER; // File found and User math then Submit job pFile = MyFile; CALLP NETPPECL(SBMPGM : SBMLIB : JOBDFILE : JOBDLIB : JOBQ : JOBQLIB : SBMUSER : RCDLEN : pFile); EndIf; // User_Profile EndIf; // Check File Read NETPPEDB; EndDo; EndIf; // Create File EndIf; // Server Id *InLr = *on; /End-Free NETPPECL CL Program /************************************************************/ /* Program : NETPPECL Net Post processing Exit Submit Job. */ /* This program will start when a file is recieved */ /* in IFS file share. */ /* This CL program is Called from RPG Program NETPPE. */ /* NETPPE Exit point registered to QIBM_QPWFS_FILE_SERV */ /* (C) Poul Aschenbrenner, COOP IT */ /************************************************************/ PGM PARM(&LIB &PGM &JOBD &JOBDLIB &JOBQ + &JOBQLIB &SBMUSER &RCDLEN &PFILE) DCL VAR(&LIB) TYPE(*CHAR) LEN(10) DCL VAR(&PGM) TYPE(*CHAR) LEN(10) DCL VAR(&JOB) TYPE(*CHAR) LEN(10) DCL VAR(&JOBD) TYPE(*CHAR) LEN(10) DCL VAR(&JOBDLIB) TYPE(*CHAR) LEN(10) DCL VAR(&JOBQ) TYPE(*CHAR) LEN(10) DCL VAR(&JOBQLIB) TYPE(*CHAR) LEN(10) DCL VAR(&SBMUSER) TYPE(*CHAR) LEN(10) DCL VAR(&RCDLEN) TYPE(*DEC) LEN(5 0) DCL VAR(&PFILE) TYPE(*CHAR) LEN(32) /* Submit job */ SBMJOB CMD(CALL PGM(NETPPECALL) PARM(&LIB &PGM + &RCDLEN &PFILE)) JOB(&PGM) + JOBD(&JOBDLIB/&JOBD) JOBQ(&JOBQLIB/&JOBQ) + USER(&SBMUSER) ENDPGM NETPPEDB Data Base Source File A R NETSBM A CHKFILE 32A A CHKUSER 10A A RCDLEN 5 0 A SBMUSER 10A A SBMPGM 10A A SBMLIB 10A A JOBDLIB 10A A JOBDFILE 10A A JOBQLIB 10A A JOBQ 10A A COMMENT 50A NETPPECALL CL Program /************************************************************/ /* Program : NETPPECALL Net Post processing Exit Submit Job.*/ /* This program will start when a file is received */ /* in IFS file share. */ /* This CL program is submit from CL Program NETPPECL. */ /* (C) Poul Aschenbrenner, COOP IT */ /************************************************************/ PGM PARM(&SBMLIB &SBMPGM &RCDLEN &PFILE) DCL VAR(&SBMPGM) TYPE(*CHAR) LEN(10) DCL VAR(&SBMLIB) TYPE(*CHAR) LEN(10) DCL VAR(&RCDLEN) TYPE(*DEC) LEN(5 0) DCL VAR(&PFILE) TYPE(*CHAR) LEN(32) /* Wait for File Received */ CHK: CHKOUT OBJ(&PFILE) MONMSG MSGID(CPF0000) EXEC(DO) /* ANY OTHER ERROR + (IN USE) */ CHKIN OBJ(&PFILE) /* RELEASE USE */ MONMSG MSGID(CPF0000) DLYJOB DLY(2) GOTO CMDLBL(CHK) ENDDO CHKIN OBJ(&PFILE) /* RELEASE USE */ MONMSG MSGID(CPF0000) /* Create Stream File to QTEMP */ DLTF FILE(QGPL/NETPPE) MONMSG MSGID(CPF0000) CRTPF FILE(QGPL/NETPPE) RCDLEN(&RCDLEN) /* Copy Received Stream File to QTEMP */ CPYFRMSTMF FROMSTMF(&PFILE) + TOMBR('/QSYS.LIB/QTEMP.LIB/NETPPE.FILE/NETP+ PE.MBR') MBROPT(*REPLACE) CVTDTA(*TBL) + TBL('/QSYS.LIB/QGPL.LIB/A2521142.TBL') /* Call Program to start */ SNDPGMMSG MSG(&SBMPGM) TOMSGQ(*SYSOPR) CALL PGM(&SBMLIB/&SBMPGM) PARM('QTEMP' 'NETPPE') ENDPGM
[report a broken link by clicking here]