Merge Spooled Files (MRGSPLFOND)

The Merge Spooled Files (MRGSPLFOND) command combines multiple SNA character stream (SCS) spooled files and writes the result to a single spooled file or database file member. Spooled files to be merged must be contained in a single output queue and must be in ready (RDY) status. Spooled files that are not in a Ready (RDY) status and that are not SCS will be left in the source output queue.

The first spooled file that is processed is used to define the attributes of the merged spooled file. All subsequent spooled files to be merged must have identical attributes. After each spooled file is merged successfully, it can be deleted or moved to another output queue where it can be optionally placed on hold. The resulting merged spooled file or database file member can also be automatically archived into a specified Application Group and Application within an OnDemand Common Server instance, after merge processing has completed.

Note: When processing begins, spooled files are selected to be merged. Spooled files which are added to the source output queue after the selection process completes will not be merged.

Spooled files that do not have identical attributes to the first spooled file processed will not be processed. A message can be written to the joblog for each spooled file that is not processed. The message will indicate that, due to the attribute difference listed in the message, the spooled file could not be merged. Spooled files that are not processed will be left in the source output queue in RDY status.

Restrictions:

Parameters

Keyword Description Choices Notes
FROMOUTQ From output queue Qualified object name Required, Positional 1
Qualifier 1: From output queue Name
Qualifier 2: Library Name, *LIBL, *CURLIB
OUTPUT Output *TOFILE, *TOOUTQ Optional
TOOUTQ To output queue Qualified object name Optional
Qualifier 1: To output queue Name
Qualifier 2: Library Name, *LIBL, *CURLIB
TOFILE To file Qualified object name Optional
Qualifier 1: To file Name
Qualifier 2: Library Name, *LIBL, *CURLIB
TOMBR To member Name, *FIRST Optional
MBROPT Replace or add records *REPLACE, *ADD Optional
DLTPRCSPLF Delete processed spooled files *NO, *YES Optional
PRCOUTQ Processed files output queue Qualified object name Optional
Qualifier 1: Processed files output queue Name
Qualifier 2: Library Name, *LIBL, *CURLIB
HLDPRCSPLF Hold processed spooled files *NO, *YES Optional
SPLF Spooled file Name, *ALL Optional
FORMTYPE Form type Character value, *ALL, *STD Optional
USRDTA User data Character value, *ALL, *NONE Optional
JOB Job name Single values: *
Other values: Qualified job name
Optional
Qualifier 1: Job name Name, *ALL
Qualifier 2: User Name, *ALL
Qualifier 3: Number 000000-999999, *ALL
USRDFNOPT User defined option Single values: *ALL, *NONE
Other values (up to 4 repetitions): Character value
Optional
USRDFNDTA User defined data Character value, *ALL, *NONE Optional
NBRFILES Maximum spooled files to merge Integer, *NOMAX Optional
ARCHIVE Archive merged file *NO, *YES Optional
APPGRP Application group Character value Optional
APP Application Character value Optional
INSTANCE Instance Character value, *DFT Optional
DLTINPUT Delete input *NO, *YES Optional
IDXONLY Run indexing only *NO, *YES Optional
STASHFILE Password stash file Path name, *NONE Optional
ERROPT Error option *RMVRPT, *NORMVRPT Optional
STRSVR Start instance server *NO, *YES Optional
SBMJOB Submit to batch *YES, *NO Optional
JOBD Job description Qualified object name Optional
Qualifier 1: Job description Name, QOND400
Qualifier 2: Library Name, QRDARS, *LIBL, *CURLIB
NOTPRCMSG Not processed file messages *NONE, *INFO Optional

From output queue (FROMOUTQ)

Specifies the name of output queue containing the spooled files to be merged.

This is a required parameter.

Qualifier 1: From output queue

output-queue-name
Specify the name of the output queue where the spooled files can be found.

Qualifier 2: Library

*LIBL
All libraries in the library list for the current job are searched until the first match is found.
*CURLIB
The current library for the job is used to locate the output queue. If no current library entry exists in the library list, QGPL is used.
library-name
Specify the library where the output queue is located.

Output (OUTPUT)

Specifies whether the output created after merging the specified SCS spooled files is a spooled file or database file.

*TOFILE
Specifies that output of the merged spooled files will be the database file specified by the To file (TOFILE) parameter.
*TOOUTQ
Specifies that output of the merged spooled files will be a spooled file in an output queue specified by the To output queue (TOOUTQ) parameter.

To output queue (TOOUTQ)

Specifies the output queue where the resulting merged spooled file will be placed. The spooled file name of the merged files will be the same as the first spooled file processed that matches the selection criteria specified.

This is a required parameter, if OUTPUT(*TOOUTQ) is specified.

Qualifier 1: To output queue

output-queue-name
Specify the name of the output queue where the resulting merged spooled file will be placed.

Qualifier 2: Library

*LIBL
All libraries in the library list for the current job are searched until the first match is found.
*CURLIB
The current library for the job is used to locate the output queue. If no current library entry exists in the library list, QGPL is used.
library-name
Specify the library where the output queue is located.

To file (TOFILE)

Specifies the database file name and member where the resulting merged file will be placed. If the file does not exist, it will be automatically created. If the default library value of *LIBL is specified, and the file does not already exist, it will not be created automatically.

This is a required parameter, if OUTPUT(*TOFILE) is specified.

Qualifier 1: To file

file-name
Specify the name of the database file where the resulting merged spooled file will be placed.

Qualifier 2: Library

*LIBL
All libraries in the library list for the current job are searched until the first match is found.
*CURLIB
The current library for the job is used to locate the database file. If no current library entry exists in the library list, QGPL is used.
library-name
Specify the library where the database file is located.

To member (TOMBR)

Specifies the name of the file member that receives the merged records.

*FIRST
The first member in the database file is used.
member-name
Specify the member name where the output will be placed.

Replace or add records (MBROPT)

Specifies whether the first input spooled file replaces or is appended to the end of the existing records in the merged output file member. Each subsequent input spooled file will be appended to the end of the previous records in the output file member. If the output file or member does not exist, it will be automatically created. If the TOFILE default library value of *LIBL is specified, and the file does not already exist, it will not be created automatically.

*REPLACE
The system clears the existing member and adds the new records.
*ADD
The system adds the new records to the end of the existing records.

Delete processed spooled files (DLTPRCSPLF)

Specifies whether or not to delete a spooled file that MRGSPLFOND processes successfully. If MRGSPLFOND is unsuccessful, the spooled file is not deleted.

*NO
Specifies that successfully processed spooled files will not be deleted.
*YES
Specifies that successfully processed spooled files will be deleted.

Note: Delete processed spooled files (DLTPRCSPLF) *YES can not be specified with Run indexing only (IDXONLY) *YES.

Processed files output queue (PRCOUTQ)

Specifies the output queue where successfully processed spooled files will be moved.

This is a required parameter, if Delete processed spooled files (DLTPRCSPLF) is *NO.

Qualifier 1: Move processed files to outq

output-queue-name
Specify the name of the output queue where the successfully processed spooled files will be moved.

Qualifier 2: Library

*LIBL
All libraries in the library list for the current job are searched until the first match is found.
*CURLIB
The current library for the job is used to locate the output queue. If no current library entry exists in the library list, QGPL is used.
library-name
Specify the library where the output queue is located.

Hold processed spooled files (HLDPRCSPLF)

Specifies whether or not to hold successfully processed spooled files after they are moved to the processed output queue.

*NO
Specifies that moved spooled files will not be held.
*YES
Specifies that moved spooled files will be held.

Spooled file (SPLF)

Specifies the name of the spooled files that are selected to be merged.

*ALL
All spooled file names found on the source output queue will be merged.
spooled-file-name
The spooled file name of the input files to be merged.

Form type (FORMTYPE)

Specifies the type of form of the spooled files that are to be merged.

*ALL
All form types found on the source output queue will be merged.
*STD
Spooled files with the standard printer form for your computer system will be merged.
character-value
Specify the identifier of the form type of the spooled files that will be merged.

User data (USRDTA)

Specifies user-specified data that identifies the files to be merged.

*ALL
All user-specified data found on the source output queue will be merged.
*NONE
The user data must be blank for files to be selected to be merged.
character-value
Specify the value for the user data which identifies the spooled files to be merged.

Job name (JOB)

Specifies the job that created the spooled files to be merged.

Single values

*
All spooled files for the current job found on the from output queue will be merged.

Qualifier 1: Job name

*ALL
Spooled files for all job names found on the from output queue will be merged.
job-name
Specify the name of the job that created the spooled files to be merged.

Qualifier 2: User

*ALL
Spooled files for all user names found on the source output queue will be merged.
user-name
Specify the user name that identifies the user profile under which the job was run.

Qualifier 3: Number

*ALL
Spooled files for all job numbers found on the source output queue will be merged.
0-999999
Specify the system-assigned job number. If a job number is specified, the job name and user must also be specified.

User defined option (USRDFNOPT)

Specifies one or more user-defined options to be used to select the spooled files to be merged. A maximum of four user-defined options can be specified.

Single values

*ALL
Spooled files for all user-defined options found on the source output queue will be merged.
*NONE

The user-defined option must be blank for files to be selected to be merged.

Other values (up to 4 repetitions)

character-value
Specify no more than 10 characters of text which identify the spooled files to be merged.

User defined data (USRDFNDTA)

Specifies user-defined data to be used to select the spooled files to be merged.

*ALL
Spooled files for all user-defined data found on the source output queue will be merged.
*NONE
The user-defined data must be blank for files to be selected to be merged.
character-value
Specify up to 255 characters of text which identify the spooled files to be merged.

Note: If you specify to archive the merged spooled file using the Add Report to OnDemand (ADDRPTOND) command, only the first 60 characters of the user defined data will be used when Application group APPGRP(*USRDFNDTA) or Application APP(*USRDFNDTA) is specified.

Maximum spooled files to merge (NBRFILES)

Specifies the maximum number of spooled files to be merged.

*NOMAX
All selected spooled files will be merged.
integer
Specify the number of spooled files to merge.

Archive merged file (ARCHIVE)

Specifies whether or not to archive the merged output file using the Add Report to OnDemand (ADDRPTOND) command.

When the MRGSPLFOND command is run with OUTPUT(*TOFILE) and ARCHIVE(*YES), after all the spooled files are copied into the To file (TOFILE), the Add Report to OnDemand (ADDRPTOND) command is executed with INPUT(*FILE).

When the MRGSPLFOND command is run with OUTPUT(*TOOUTQ) and ARCHIVE(*YES), the spooled files are copied into a temporary physical file, that physical file is copied to a spooled file in the To output queue (TOOUTQ), and the Add Report to OnDemand (ADDRPTOND) command is executed with INPUT(*SPLF).

*NO
Specifies that the merged file will not be archived using the Add Report to OnDemand (ADDRPTOND) command.
*YES
Specifies that the merged file will be archived using the Add Report to OnDemand (ADDRPTOND) command.

Application group (APPGRP)

Specifies the name of the application group to be used with the Add Report to OnDemand (ADDRPTOND) command.

This is a required parameter, if Archive merged file (ARCHIVE) is *YES.

Note: Position the cursor in the application group parameter entry and use the prompt (F4) key to view the list of application group values that are available for the default (*DFT) instance.

The default instance is specified in the QDFTINST data area. The QDFTINST data area can exist in multiple libraries. A search for the QDFTINST data area is performed using the library list. The first data area found will be used. If the QDFTINST data area is not found using the library list, the QUSRRDARS library will be searched for the data area. If the data area exists in the QUSRRDARS library it will be used. If the QDFTINST data area is not found, instance QUSROND is used.

character-value
Specify the application group name. If the value to be entered contains lower case letters, blanks, or special characters, it must be enclosed in apostrophes.
*JOBNAME
Use the job name of the first input spooled file as the source for the application group name.
*SPLFNAME
Use the spooled file name of the first input spooled file as the source for the application group name.
*FORMTYPE
Use the form type of the first input spooled file as the source for the application group name.
*USERDATA
Use the user data of the first input spooled file as the source for the application group name.
*USRDFNOPT1
Use the user-defined option 1 of the first input spooled file as the source for the application group name.
*USRDFNOPT2
Use the user-defined option 2 of the first input spooled file as the source for the application group name.
*USRDFNOPT3
Use the user-defined option 3 of the first input spooled file as the source for the application group name.
*USRDFNOPT4
Use the user-defined option 4 of the first input spooled file as the source for the application group name.
*USRDFNDTA
Use the user-defined data of the first input spooled file as the source for the application group name.

Application (APP)

Specifies the name of the application to be used with the Add Report to OnDemand (ADDRPTOND) command.

Note: Position the cursor in the application parameter entry and use the prompt (F4) key to view the list of application values that are available for the default (*DFT) instance.

The default instance is specified in the QDFTINST data area. The QDFTINST data area can exist in multiple libraries. A search for the QDFTINST data area is performed using the library list. The first data area found will be used. If the QDFTINST data area is not found using the library list, the QUSRRDARS library will be searched for the data area. If the data area exists in the QUSRRDARS library it will be used. If the QDFTINST data area is not found, instance QUSROND is used.

*APPGRP
Use the application group name as the source for the application name. This value will also work if the application group only contains one application regardless of the name of the application.
*JOBNAME
Use the job name of the first input spooled file as the source for the application name.
*SPLFNAME
Use the spooled file name of the first input spooled file as the source for the application name.
*FORMTYPE
Use the form type of the first input spooled file as the source for the application name.
*USERDATA
Use the user data of the first input spooled file as the source for the application name.
*USRDFNOPT1
Use the user-defined option 1 of the first input spooled file as the source for the application name.
*USRDFNOPT2
Use the user-defined option 2 of the first input spooled file as the source for the application name.
*USRDFNOPT3
Use the user-defined option 3 of the first input spooled file as the source for the application name.
*USRDFNOPT4
Use the user-defined option 4 of the first input spooled file as the source for the application name.
*USRDFNDTA
Use the user-defined data of the first input spooled file as the source for the application name.
character-value
Specify the application name. If the value to be entered contains lower case letters, blanks, or special characters, it must be enclosed in apostrophes.

Instance (INSTANCE)

Specifies the name of the instance to use.

Specifies the name of the OnDemand instance to use.

*DFT
The default OnDemand instance is used. The default instance is specified in the QDFTINST data area. The QDFTINST data area can exist in multiple libraries. A search for the QDFTINST data area is performed using the library list. The first data area found will be used. If the QDFTINST data area is not found using the library list, the QUSRRDARS library will be searched for the data area. If the data area exists in the QUSRRDARS library it will be used. If the QDFTINST data area is not found, instance QUSROND is used.
instance-name
Specify the name of the instance that is to be used. By definition, the instance must be on the system where the command is run.

Delete input (DLTINPUT)

Specifies whether the input data is deleted after the data is successfully loaded by the Add Report to OnDemand (ADDRPTOND) command. An unsuccessful Add Report to OnDemand (ADDRPTOND) command does NOT delete the input.

*NO
The input data is kept.
*YES
The input data is deleted.

Run indexing only (IDXONLY)

Specifies whether to run only the indexing part of the Add Report to OnDemand (ADDRPTOND) command.

*NO
Run the complete load process.
*YES
Run only the indexing process.

Note: Run indexing only (IDXONLY) *YES can not be specified with Delete processed spooled files (DLTPRCSPLF) *YES.

Password stash file (STASHFILE)

Specifies the path and file name of the stream file that contains the stashed user profile and password to run the command.

*NONE
A stash file will not be used to run the command, the current user profile will be used.
path-name
Specifies the path and file name of the stream file that contains the stashed user profile and password.

Note: Use the ARSSTASH API to store the user profile and password in the stash file.

Error option (ERROPT)

Specifies what to do if the Add Report to OnDemand (ADDRPTOND) command is not successful.

*RMVRPT
Remove all data loaded up to the point of the failure.
*NORMVRPT
No data is removed. See the system log to determine what was added.

Start instance server (STRSVR)

Specify to start the instance server if it is not currently active.

*NO
The instance server for this instance will not be started.
*YES
The instance server for this instance will be started.

Submit to batch (SBMJOB)

Specify if you want to perform merge processing in a separate batch job.

*YES
This command should be submitted to run in a different job.
*NO
This command should be run within the current job. If you are entering this command from a terminal, this will prevent you from doing any other work from this terminal session until this command completes.

Job description (JOBD)

Specifies the name of the job description used for the submitted job.

Qualifier 1: Job description

QOND400
The QOND400 job description is used as the job description for the submitted job.
jobd-name
Specify the name of the job description used for the submitted job.

Qualifier 2: Library

QRDARS
Library QRDARS is used as the job description's library.
*LIBL
All libraries in the job's library list are searched until the first match is found.
*CURLIB
The current library for the job is used to locate the job description name. If no library is specified as the current library for the job, QGPL is used.
library-name
Specify the name of the library where the job description name is located.

Not processed file messages (NOTPRCMSG)

Specifies whether informational messages should be written to the job log for spooled files that are selected but could not be processed because of a spooled file attribute mismatch.

*NONE
No informational messages about spooled file attributes that do not match the first spooled file will be written to the job log.
*INFO
Informational messages about spooled file attributes that do not match the first spooled file will be written to the job log.

Examples

Example 1: Merge and Archive All Reports with Form Type *STD

MRGSPLFOND FROMOUTQ(QPRINT) OUTPUT(*TOFILE)
           TOFILE(QGPL/MERGEDRPT) PRCOUTQ(QGPL/PRT01)
           FORMTYPE(*STD) ARCHIVE(*YES) APPGRP(*USERDATA)
           SBMJOB(*YES)

This command merges all reports in the QPRINT output queue with form type *STD and places the merged output in a file called MERGEDRPT in library QGPL. After each spooled file is successfully merged it is moved to output queue PRT01 in library QGPL.

After the merge processing has been completed, the merged output is archived using the Add Report to OnDemand (ADDRPTOND) command. The Application Group name is obtained from the user data found in the first spooled file that is merged.

All merge and archive processing will run in a separate batch job.

Example 2: Merge up to 500 Checks

MRGSPLFOND FROMOUTQ(PAYABLES) OUTPUT(*TOFILE)
           TOFILE(QGPL/CHECKS) MBROPT(*ADD)
           PRCOUTQ(QGPL/APCHECKS) HLDPRCSPLF(*YES)
           SPLF(CHKSPRTF) USRDTA(PAYABLES) JOB(CHECKS)
           NBRFILES(500) ARCHIVE(*NO) SBMJOB(*YES)

This command merges spooled files from the PAYABLES output queue that have been printed with the CHKSPRTF printer file, have user data of PAYABLES and were created by a job called CHECKS. All successfully merged spooled files will be appended to the first database file member of the CHECKS file in library QGPL. Only the first 500 spooled files with matching selection criteria will be merged. All successfully merged spooled files will be moved to the APCHECKS output queue in library QGPL and placed on hold.

All merge processing will be run in a separate batch job.

Example 3: Merge and Archive All Reports with Form Type *STD to an Output Queue

MRGSPLFOND FROMOUTQ(QPRINT) OUTPUT(*TOOUTQ)
           TOOUTQ(QGPL/ACCOUNTING) PRCOUTQ(QGPL/PRT01)
           FORMTYPE(*STD) ARCHIVE(*YES) APPGRP(*USERDATA)
           SBMJOB(*YES)

This command merges all reports in the QPRINT output queue with form type *STD and places the merged output in an output queue named ACCOUNTING in library QGPL. After each spooled file is successfully merged it is moved to output queue PRT01 in library QGPL.

After the merge processing has been completed, the merged output is archived using the Add Report to OnDemand (ADDRPTOND) command. The Application Group name is obtained from the user data found in the first spooled file that is merged.

All merge and archive processing will run in a separate batch job.

Error messages

*ESCAPE Messages

CPF1002
Cannot allocate object &1.
CPF1338
Errors occurred on SBMJOB command.
CPF3342
Job &5/&4/&3 not found.
CPF3343
Duplicate job names found.
CPF3344
File &1 number &8 no longer in the system.
CPF3492
Not authorized to spooled file.
CPF3557
Error occurred copying spooled file to data base file.
CPF3C40
Spooled file &4 not found.
CPF9801
Object &2 in library &3 not found.
CPF9802
Not authorized to object &2 in &3.
CPF9803
Cannot allocate object &2 in library &3.
CPF9807
One or more libraries in library list deleted.
CPF9808
Cannot allocate one or more libraries on library list.
CPF9810
Library &1 not found.
CPF9812
File &1 in library &2 not found.
CPF9820
Not authorized to use library &1.
CPF9872
Program or service program &1 in library &2 ended. Reason code &3.
CPF9899
Error occurred during processing of command.
GUI0114
The list cannot be completed. No auxiliary server jobs are running or can be started.
OND0211
ADDRPTOND command ended in error.
OND2044
Instance &1 not found.
OND2046
User-defined option does not exist for spooled file.
OND2049
Application group not found.
OND2050
Application not found.