Printing to Axis NPS Print Servers from AS/400


1. AS/400 printing to Axis NPS Print Servers using LPR/LPD.

1.1 Method to be used for OS/400 ver 3.1. 2

2. Axis AS/400 LPR monitor (AXLPRMON)

2.1 Method to be used with OS/400 2.3 and 3.05. 4

2.2 Source code for AXLPRSTART 6

2.3 Source code for AXLPRMON 7

Version 1.1 14 July 1995. HG.

1.0 AS/400 printing to Axis NPS Print Servers using LPR/LPD.

1.1 Method to be used for OS/400 ver 3.1.

TCP/IP Connectivity Utilities is free of charge in OS/400 but is not necessary a part of the standard installation. If You are using a OS/400 version prior to 3.1 You should use the method described in the next section "Axis AS/400 LPR Monitor”.

Before You start the following procedure, You should have configured the Axis NPS with an appropriate IP adress. Do not use the default IP adress.

( This could be done by using the Axis DOS/Windows utility AXCFG which could be obtained free of charge from Your local dealer , also other means of doing this is described in detail in the NPS Manuals).

  1. Log in as QSECOFR.
  2. At prompt type: "go cfgtcp”, to get to the "Configure TCP/IP Menu”.
  3. Choose menu item 10 , "Work with TCP/IP host table entries”.
  4. Choose menu item 1 "add”. Press enter.
  5. Type in Internet address and hostname of the NPS.
  6. At command prompt type: " crtoutq ", and fill in the required information as per the following example.
  7. Verify by sending a job to the output queue. ( NPSHP4 in the following example ).

Hints:

  • More than one 1 writer could be used to increase throughput.

(Typically 1-3 ).

  • Large jobs could be spooled and printed at a later time
  • Use the NPS parameters to control papersize etc.

Example.

The text printed bold has to be filled in. ( N.b. this is an example only ).

Create Output Queue (CRTOUTQ)

Type choices, press Enter.

Output queue . . . . . . . . . . > NPSHP4 Name

Library . . . . . . . . . . . > QGPL Name, *CURLIB

Maximum spooled file size:

Number of pages . . . . . . . *NONE Number, *NONE

Starting time . . . . . . . . Time

Ending time . . . . . . . . . Time

+ for more values

Order of files on queue . . . . *FIFO *FIFO, *JOBNBR

Remote system . . . . . . . . . > 'nps_1'

Remote printer queue . . . . . . 'pr1'

Writers to autostart . . . . . . 1 1-10, *NONE

More...

F3=Exit F4=Prompt F5=Refresh F10=Additional parameters F12=Cancel

F13=How to use this display F24=More keys

--------------------------------

Create Output Queue (CRTOUTQ)

Type choices, press Enter.

Queue for writer messages . . . QSYSOPR Name

Library . . . . . . . . . . . *LIBL Name, *LIBL, *CURLIB

Connection type . . . . . . . . > *IP *SNA, *IP

Destination type . . . . . . . . > *OTHER *OS400, *OS400V2, *PSF2...

Transform SCS to ASCII . . . . . *YES *YES, *NO

Manufacturer type and model . . > *HP4

Destination options . . . . . . *NONE

Text 'description' . . . . . . . 'HP 4 attached to NPS'

Bottom

F3=Exit F4=Prompt F5=Refresh F10=Additional parameters F12=Cancel

F13=How to use this display F24=More keys

2. Axis AS/400 LPR monitor (AXLPRMON)

2.1 Method to be used with OS/400 2.3 and 3.05.

Introduction

This section describes how to print directly from an AS/400 to an NPS through LPR. The NPS Workarounds database (obtainable from Axis Technical Support) lists and shortly describes other solutions for the AS/400. Still, these other solutions require some intermediate device for making protocol and datastream conversions.

Note that for OS/400 2.3 and later TCP/IP Connectivity Utilities must be installed to get LPR. LPR is not included before OS/400 2.3.

The implementation of LPR in OS/400 2.3 is only interactive (manual). Some means of automating the printing process is desired.

AXLPRMON provides the automation of print. It consists of a fairly simple CL program that is started as a batch job. It will check for queued print jobs in one given queue, and sends each print job in turn using LPR. AXLPRMON can be started in many sessions, each one monitoring one queue.

The Red Book AS/400 Printing III lists a similar print monitor. This is in comparison a fairly complex piece of work, and requires a C compiler on the AS/400, which very few have.

This is the basic print job flow, when using AXLPRMON:

+-------------+ +-------+ +----------+ +-----+ +-----+ +---------+

| Application |-->| Queue |-->| AXLPRMON |-->| LPR |-->| NPS |-->| Printer |

+-------------+ +-------+ +----------+ +-----+ +-----+ +---------+

Installation

By manually enter or use PC Support, Client Access, FTP, or any other means for file transfer, AXLPRMON and AXLPRSTART should be stored on the AS/400 as members under AXLPRMON/QCLSRC, where QCLSRC should be defined as a file for CL source code.

Compile AXLPRMON using CRTCLPGM. By default it will be placed under the AXLPRMON directory. Note that you should be logged on as QSECOFR and set USRPRF(*OWNER) when compiling AXLPRMON, to give use of it a decent level of security.

Edit AXLPRSTART to your needs. You may copy the sample command several times to start many AXLPRMON sessions, one for each queue created. AXLPRSTART contains a description of each value that needs to be entered by you.

Compile AXLPRSTART.

Start AXLPRSTART using CALL.

More queues, and corresponding entries to AXLPRSTART, can be added later. Remember to re-compile AXLPRSTART after change.

2.2 Source code for AXLPRSTART

/**********************************************************************

/*

/* Program - AXLPRSTART

/*

/* Description - Sample script for starting one Axis LPR Print Monitor

/* (AXLPRMON) instance

/*

/* Author - Mikael Brynolf IBS, Anders Borg Axis Communications AB

/*

/* History - Nov 17 1994: First version

/* - Mar 5 1995: Adapted to new AXLPRMON

/*

/**********************************************************************

PGM

/* The following values must be altered per each instance of AXLPRMON:

/* queue: Name of the queue to monitor.

/* nps_name: Name of the NPS to receive the output.

/* nps_port: Name of the logical printer port of the NPS, pr1 to pr8.

/* Typically: pr1 for LPT1, pr2 for LPT2, and pr3 for COM1

/* printer: Brand and model of printer, as listed in AS/400 TCP/IP Guide

/* in the LPR chapter.

/* job_name: Set this to same value as <queue>.

/*

/* What follows is an example, showing settings of the above values:

/* SBMJOB CMD(CALL PGM(AXLPRMON/AXLPRMON) PARM(HP3_IN_HALL +

/* NPS_IN_HALL PR1 *HPIII)) JOB(HP3_IN_HALL) +

/* JOBQ(QS36EVOKE)

/*

SBMJOB CMD(CALL PGM(AXLPRMON/AXLPRMON) PARM(queue +

nps_name nps_port printer)) JOB(job_name) +

JOBQ(QS36EVOKE)

ENDPGM

2.3 Source code for AXLPRMON

/**********************************************************************

/* Program - AXLPRMON

/* Description - LPR Print Monitor for OS/400 2.3

/* Compilation - QSECOFR, *OWNER

/* Author - Mikael Brynolf IBS, Anders Borg Axis Communications AB

/* History - Nov 18 1994: First version

/* - Mar 5 1995: Added more comments, etc.

/**********************************************************************

/* Program parameters:

/* OUTQ: The AS/400 output queue name

/* HOSSY: The print server name

/* HOSPR: The logical printer port name: PR1 to PR8

/* HOSTP: The printer type

/*

PGM PARM(&OUTQ &HOSSY &HOSPR &HOSTP)

/*

/* Declarations

DCL VAR(&RECORD) TYPE(*CHAR) LEN(128)

DCL VAR(&LENGTH) TYPE(*DEC) LEN(5 0)

DCL VAR(&WAIT) TYPE(*DEC) LEN(5 0) VALUE(-1)

DCL VAR(&TYP01) TYPE(*CHAR) LEN(10) /* '*SPOOL'

DCL VAR(&TYP02) TYPE(*CHAR) LEN(2) /* '01'

DCL VAR(&JOBNM) TYPE(*CHAR) LEN(10) /* Job name

DCL VAR(&JOBUS) TYPE(*CHAR) LEN(10) /* Job user

DCL VAR(&JOBNR) TYPE(*CHAR) LEN(6) /* Job number

DCL VAR(&SPONM) TYPE(*CHAR) LEN(10) /* Spool name

DCL VAR(&SPONR) TYPE(*DEC) LEN(5 0) /* Spool number

DCL VAR(&OUTQT) TYPE(*CHAR) LEN(10) /* Output queue

DCL VAR(&LIB) TYPE(*CHAR) LEN(10) /* Library

DCL VAR(&OUTQ) TYPE(*CHAR) LEN(10) /* Output queue

DCL VAR(&HOSSY) TYPE(*CHAR) LEN(10) /* LPD host

DCL VAR(&HOSPR) TYPE(*CHAR) LEN(10) /* LPD queue

DCL VAR(&HOSTP) TYPE(*CHAR) LEN(17) /* LPD printer

/*

/* Change job

/*

CHGJOB RUNPTY(40)

/*

/* Create data queue if it doesn't exist

/*

CRTDTAQ DTAQ(AXLPRMON/&OUTQ) MAXLEN(128) FORCE(*NO)

MONMSG MSGID(CPF0000)

/*

/* Create the output queue if it doesn't exist

/* Link data queue to output queue

/*

CRTOUTQ OUTQ(QGPL/&OUTQ) TEXT(AXLPRMON) +

DTAQ(AXLPRMON/&OUTQ)

MONMSG MSGID(CPF0000) EXEC(DO)

CHGOUTQ OUTQ(QGPL/&OUTQ) DTAQ(AXLPRMON/&OUTQ)

MONMSG MSGID(CPF0000)

ENDDO

/**********************************************************************

/* Wait for record in data queue

/**********************************************************************

LOOP:

CALL PGM(QRCVDTAQ) PARM(&OUTQ AXLPRMON &LENGTH +

&RECORD &WAIT)

/*

/* Extract value entities from the record

/*

CHGVAR VAR(&TYP01) VALUE(%SST(&RECORD 1 10))

CHGVAR VAR(&TYP02) VALUE(%SST(&RECORD 11 2))

CHGVAR VAR(&JOBNM) VALUE(%SST(&RECORD 13 10))

CHGVAR VAR(&JOBUS) VALUE(%SST(&RECORD 23 10))

CHGVAR VAR(&JOBNR) VALUE(%SST(&RECORD 33 6))

CHGVAR VAR(&SPONM) VALUE(%SST(&RECORD 39 10))

CHGVAR VAR(&SPONR) VALUE(%BIN(&RECORD 49 4))

CHGVAR VAR(&OUTQT) VALUE(%SST(&RECORD 53 10))

CHGVAR VAR(&LIB) VALUE(%SST(&RECORD 63 10))

/*

/* If not correct record type: loop

/*

IF (&TYP01 *NE '*SPOOL') THEN(GOTO LOOP)

IF (&TYP02 *NE '01') THEN(GOTO LOOP)

/*

/* Send the spooled file using LPR

/* If error occurs: Jump to next item in list

/*

LOOP2:

SNDTCPSPLF RMTSYS(&HOSSY) PRTQ(&HOSPR) FILE(&SPONM) +

JOB(&JOBNR/&JOBUS/&JOBNM) SPLNBR(&SPONR) +

MFRTYPMDL(&HOSTP) DLTSPLF(*YES)

MONMSG MSGID(TCP3703) EXEC(GOTO LOOP2)

MONMSG MSGID(TCP0000) EXEC(GOTO LOOP)

MONMSG MSGID(CPF0000) EXEC(GOTO LOOP)

/*

/* Next record

/*

GOTO LOOP

ENDPGM