File transfer with notify
File transfer with notify
You can integrate LongReach into a business process by using the send with notify file transfer from the LongReach app. The send with notify feature tells the LongReach server to send a message to a data queue for each file transferred. To process these messages you need a program that monitors the data queue, retrieves the messages and processes them. The monitoring program might copy the files, or load the file contents into a database, or call another program to process the messages. The business logic for processing the message depends on what you want to do with each file.
All you need is a data queue, a program to process the messages and a data queue directive in the LongReach server configuration file.
To create a data queue execute the command: CRTDTAQ DTAQ(MYLIB/LRNOTIFY) MAXLEN(1024)
Here is a sample CL program that monitors a data queue and sends a program message when a message from LongReach arrives on the data queue.
PGM
DCL VAR(&DQNAME) TYPE(*CHAR) LEN(10) VALUE('LRNOTIFY')
DCL VAR(&DQLIB) TYPE(*CHAR) LEN(10) VALUE('MYLIB')
DCL VAR(&DQLEN) TYPE(*DEC) LEN(5 0)
DCL VAR(&DQDATA) TYPE(*CHAR) LEN(1024)
DCL VAR(&DQWAIT) TYPE(*DEC) LEN(5 0) VALUE(0)
CALL QRCVDTAQ PARM(&DQNAME &DQLIB &DQLEN &DQDATA &DQWAIT)
SNDPGMMSG MSGID(CPF9898) MSGF(QCPFMSG) MSGDTA(&DQDATA)
ENDPGM
Add a loop in the program to monitor the data queue continuously, and insert your business logic to process the messages (replacing the SNDPGMMSG action). Of course you can use a programming language of your choice (you don't have to use CL).
The directive in the LongReach server configuration file is: <notify queue='/QSYS.LIB/MYLIB.LIB/LRNOTIFY.DTAQ' key='' data='{NAME},{FOLDER}/{FILE}'/>
The data parameter defines the message content and {NAME} is the user name, {FOLDER} is the name of the folder in which the file resides and {FILE} is the file name. LongReach substitutes these values for each file it transfers. For example, suppose JohnT sends a file named JTReport.txt in a folder named MonthlyReports, the data in the message that LongReach creates is JohnT,MonthlyReports/JTReport.txt.
All you need is a data queue, a program to process the messages and a data queue directive in the LongReach server configuration file.
To create a data queue execute the command: CRTDTAQ DTAQ(MYLIB/LRNOTIFY) MAXLEN(1024)
Here is a sample CL program that monitors a data queue and sends a program message when a message from LongReach arrives on the data queue.
PGM
DCL VAR(&DQNAME) TYPE(*CHAR) LEN(10) VALUE('LRNOTIFY')
DCL VAR(&DQLIB) TYPE(*CHAR) LEN(10) VALUE('MYLIB')
DCL VAR(&DQLEN) TYPE(*DEC) LEN(5 0)
DCL VAR(&DQDATA) TYPE(*CHAR) LEN(1024)
DCL VAR(&DQWAIT) TYPE(*DEC) LEN(5 0) VALUE(0)
CALL QRCVDTAQ PARM(&DQNAME &DQLIB &DQLEN &DQDATA &DQWAIT)
SNDPGMMSG MSGID(CPF9898) MSGF(QCPFMSG) MSGDTA(&DQDATA)
ENDPGM
Add a loop in the program to monitor the data queue continuously, and insert your business logic to process the messages (replacing the SNDPGMMSG action). Of course you can use a programming language of your choice (you don't have to use CL).
The directive in the LongReach server configuration file is: <notify queue='/QSYS.LIB/MYLIB.LIB/LRNOTIFY.DTAQ' key='' data='{NAME},{FOLDER}/{FILE}'/>
The data parameter defines the message content and {NAME} is the user name, {FOLDER} is the name of the folder in which the file resides and {FILE} is the file name. LongReach substitutes these values for each file it transfers. For example, suppose JohnT sends a file named JTReport.txt in a folder named MonthlyReports, the data in the message that LongReach creates is JohnT,MonthlyReports/JTReport.txt.
-
Bryan Douglas-Henry
- Posts: 1
- Joined: Wed Dec 14, 2011 1:30 am
Re: File transfer with notify
Hi
Took me a whole 3 minutes to install LongReach with default settings to get him working.
I'm not yet so 'technically grounded' to know where to look for the
Thanks
Took me a whole 3 minutes to install LongReach with default settings to get him working.
I'm not yet so 'technically grounded' to know where to look for the
Like you did the 'Create Data Queue' example, please could you give us a working example of where to find the above and where to put this ?LongReach server configuration file
<notify queue='/QSYS.LIB/MYLIB.LIB/LRNOTIFY.DTAQ' key='' data='{NAME},{FOLDER}/{FILE}'/>
Thanks
Re: File transfer with notify
Bryan,
The file to update is httpd.xml
There are many ways to update this file on the IFS. But on the green-screen, using the LONGADM profile to log in, one can execute this command:
EDTF STMF('/longreach/jsm/instance/system/httpd.xml')
HTH, *bg
The file to update is httpd.xml
There are many ways to update this file on the IFS. But on the green-screen, using the LONGADM profile to log in, one can execute this command:
EDTF STMF('/longreach/jsm/instance/system/httpd.xml')
HTH, *bg
Re: File transfer with notify
Note: LongReach Server 1.0 only supports adding the parent folder name to the data queue.
The next release of LongReach Server will add each file to the data queue.
The next release of LongReach Server will add each file to the data queue.
Re: File transfer with notify
That's great to know at this point Alick! Without the file name at this point, the integration would be more complicated; but with some QSH magic, I'm sure something can be cobbled together.alick wrote:Note: LongReach Server 1.0 only supports adding the parent folder name to the data queue.
The next release of LongReach Server will add each file to the data queue.
Have any rough ideas of the timing of that next release?
Re: File transfer with notify
It's been about a month since this post - can anyone share some rough idea of the timing of the next release of LongReach Server (and client)?starbg wrote:That's great to know at this point Alick! Without the file name at this point, the integration would be more complicated; but with some QSH magic, I'm sure something can be cobbled together.alick wrote:Note: LongReach Server 1.0 only supports adding the parent folder name to the data queue.
The next release of LongReach Server will add each file to the data queue.
Have any rough ideas of the timing of that next release?