Submitted by Anonymous (not verified) on Mon, 07/09/2007 - 00:00
Forums

I want the result of a merge with a spool file to be placed on different output queues depending on which user created the original spool file. Can this be done?

Full name
Administrator

admin

Mon, 07/09/2007 - 00:00

Yes. In AFC (Auto Forms Control) do the merge and place the result on a AFC monitored output queue with a special form type e.g. ’MERGE’. On this specific output queue make a call to a exit program conditioned by this form type. The exit program could look like this:

   
  PGM PARM(&JOB &USER &JOBNBR &FILE &FILNBR &OUTQ +
 &OUTLIB)

  /* Required parameter group */
  DCL VAR(&JOB) TYPE(*CHAR) LEN(10)
 DCL VAR(&USER) TYPE(*CHAR) LEN(10)
  DCL VAR(&JOBNBR) TYPE(*CHAR) LEN(6)
 DCL VAR(&FILE) TYPE(*CHAR) LEN(10)
  DCL VAR(&FILNBR) TYPE(*CHAR) LEN(4)
 DCL VAR(&OUTQ) TYPE(*CHAR) LEN(10)
  DCL VAR(&OUTLIB) TYPE(*CHAR) LEN(10)

  DCL VAR(&TOOUTQ) TYPE(*CHAR) LEN(10)

  /*Specify default queue*/
 CHGVAR VAR(&TOOUTQ) VALUE(’DEP00’)

  /* Find users output queue */
 IF (&USER = 'HVE ') (CHGVAR &TOOUTQ 'DEP01')
  IF (&USER = 'POULD ') (CHGVAR &TOOUTQ 'DEP02')

  /* Move spooled file to output queue */
 CHGSPLFA FILE(&FILE) JOB(&JOBNBR/&USER/&JOB) +
  SPLNBR(&FILNBR) OUTQ(&TOOUTQ) FORMTYPE(*STD)

  ENDPGM