Create AFP Data (CRTAFPDTA)

The Create AFP Data (CRTAFPDTA) command provides the following functions:

  1. Convert line data or AFPDS line data into AFPDS data. Input is a spooled file.
  2. Index a document to enhance one's ability to view, archive, or retrieve individual pages or groups of pages from large documents. The document index is written to a stream file. The input data may be line, AFPDS line or AFPDS.
  3. Retrieve and package AFP resources needed for viewing a document. The resources are written to a stream file. The input data may be line, AFPDS line or AFPDS.
  4. Merge the above-mentioned stream files so that the spooled can be viewed on a workstation using the AFP Viewer.

Input is taken from a spooled file. Output is to one or more stream files.

Note: The following values are obtained from the spooled file attributes, they cannot be specified on CRTAFPDTA: Control character, Table reference characters and DBCS SO/SI spacing.

Refer to the InfoPrint Server for OS/400: User's Guide for additional information.

Error messages for CRTAFPDTA

*ESCAPE Messages

IPS301E
CRTAFPDTA command terminated with errors.

Parameters

Keyword Description Choices Notes
FROMSPLF From spooled file Name Required, Positional 1
TOSTMF To stream file Path name, *DFT Optional, Positional 2
JOB Job name Single values: *
Other values: Qualified job name
Optional, Positional 3
Qualifier 1: Job name Name
Qualifier 2: User Name
Qualifier 3: Number 000000-999999
SPLNBR Spooled file number 1-999999, *ONLY, *LAST, *ANY Optional, Positional 4
JOBSYSNAME Job system name Character value, *ONLY, *CURRENT, *ANY Optional, Positional 5
CRTDATE Spooled file created Single values: *ONLY, *LAST
Other values: Element list
Optional, Positional 6
Element 1: Creation date Date
Element 2: Creation time Time, *ONLY, *LAST
FORMDF Form definition Single values: *SPLF, *INLINE
Other values: Qualified object name
Optional, Positional 7
Qualifier 1: Form definition Name
Qualifier 2: Library Name, *LIBL, *CURLIB
PAGDFN Page definition Single values: *SPLF, *INLINE
Other values: Qualified object name
Optional, Positional 8
Qualifier 1: Page definition Name
Qualifier 2: Library Name, *LIBL, *CURLIB
TOIDXSTMF To index stream file Path name, *NONE, *DFT Optional, Positional 9
TORSCSTMF To resource stream file Path name, *NONE, *DFT Optional, Positional 10
IDXTRG Index trigger definition Values (up to 4 repetitions): Element list Optional, Positional 11
Element 1: Record number 0-255, *
Element 2: Column number 1-32756, *
Element 3: Trigger value Character value
IDXTAGFLD Index field definition Values (up to 16 repetitions): Element list Optional, Positional 12
Element 1: Record number or literal value Character value
Element 2: Column number 1-32756
Element 3: Length 1-250
IDXTAG Index tag definition Values (up to 8 repetitions): Element list Optional, Positional 13
Element 1: Literal value Character value
Element 2: Field Values (up to 16 repetitions): *IDXTAGFLD1, *IDXTAGFLD2, *IDXTAGFLD3, *IDXTAGFLD4, *IDXTAGFLD5, *IDXTAGFLD6, *IDXTAGFLD7, *IDXTAGFLD8, *IDXTAGFLD9, *IDXTAGFLD10, *IDXTAGFLD11, *IDXTAGFLD12, *IDXTAGFLD13, *IDXTAGFLD14, *IDXTAGFLD15, *IDXTAGFLD16
IDXCDEPAG Index code page identifier 1-65535, 500 Optional, Positional 14
IDXPAGNAM Generate page names *GEN, *FILE Optional, Positional 15
IDXGRPNAM Generate group names *YES, *NO Optional, Positional 16
IDXGRP Select index for group names *IDXTAG1, *IDXTAG2, *IDXTAG3, *IDXTAG4, *IDXTAG5, *IDXTAG6, *IDXTAG7, *IDXTAG8 Optional, Positional 17
IDXOBJ Information for index file *GROUP, *ALL Optional, Positional 18
IDXPAGLMT Indexing page limit 1-99, 1 Optional, Positional 19
RSCDTA Resource data Single values: *ALL
Other values (up to 7 repetitions): *BARCODE, *FONT, *FORMDF, *GOCA, *IOCA, *OVL, *PAGSEG
Optional, Positional 20
TOMRGSTMF To merged stream file Element list Optional, Positional 21
Element 1: Stream file name Path name, *NONE, *DFT
Element 2: Keep or delete input *KEEPINPUT, *DLTINPUT
AFPCHARS AFP characters Values (up to 4 repetitions): Character value, *SPLF, *NONE Optional, Positional 22
IMAGEOUT Image output *ASIS, *IOCA Optional, Positional 23

From spooled file (FROMSPLF)

This is a required parameter.

Specifies the name of the spooled file that contains the data which will be processed by CRTAFPDTA.

The possible values are:

spooled-file-name
Specifies the name of the spooled file to be processed by CRTAFPDTA.

The following types of data can be processed by CRTAFPDTA:

To stream file (TOSTMF)

Specifies the stream file to which the transformed data is written.

The possible values are:

*DFT
The transformed data will be written to file output.afp in the current working directory. If the data is being written to qsys.lib, the file name used is outputafp.mbr.
to-stream-file-path
Specifies the path name of the stream file to which transformed data is written. All directories in the path name must exist. New directories are not created. If the stream file does not exist, it is created. If you specify the file name without a path, the output file is placed in your current working directory. If the file exists, it is overwritten. If you name a directory or path but not a file name, a file named output.afp is written. If the path name is qualified, it must be enclosed in apostrophes.

Job name (JOB)

Specifies the name of the job that created the spooled file whose data records are to be read.

The possible values are:

*
The job that issued this command is the job that created the spooled file.
job-name
Specifies the name of the job that created the spooled file.
user-name
Specifies the user name that identifies the user profile under which the job is run.
job-number
Specifies the system-assigned job number.

Spooled file number (SPLNBR)

Specifies the number of the spooled file whose data records are to be read.

The possible values are:

*ONLY
Only one spooled file from the job has the specified file name; therefore, the number of the spooled file is not necessary. If *ONLY is specified and more than one spooled file has the specified name, an error message is issued.
*LAST
The highest-numbered spooled file with the specified file name is read.
spooled-file-number
Specify the number of the spooled file whose data records are read.

Job system name (JOBSYSNAME)

Specifies the name of the system where the job that created the spooled file (JOB parameter) ran. This parameter is considered after the job name, user name, job number, spooled file name, and spooled file number parameter requirements have been met.

The possible values are:

*ONLY
There is one spooled file with the specified job name, user name, job number, spooled file name, spooled file number, and spooled file create date and time.
*CURRENT
The spooled file created on the current system with the specified job name, user name, job number, spooled file name, spooled file number, and create date and time is used.
job-system-name
Specify the name of the system where the job that created the spooled file ran.

Spooled file created (CRTDATE)

Specifies the date and time the spooled file was created. This parameter is considered after the job name, user name, job number, spooled file name, spooled file number, and job system name parameter requirements have been met.

The possible single values are:

*ONLY
There is one spooled file with the specified job name, user name, job number, spooled file name, spooled file number, and job system name.
*LAST
The spooled file with the latest create date and time of the specified job name, user name, job number, spooled file name, spooled file number, and job system name is used.
spooled-file-create-date
Specify the date the spooled file was created.

The possible create time values are:

*ONLY
There is one spooled file with the specified job name, user name, job number, spooled file name, spooled file number, job system name, and spooled file create date.
*LAST
The spooled file with the latest create time of the specified job name, user name, job number, spooled file name, spooled file number, job system name, and spooled file create date is used.
spooled-file-create-time
Specify the time the spooled file was created.

Form definition (FORMDF)

Specifies the form definition to use when processing the spooled file. A form definition is a resource object that defines the characteristics of the form (physical page) such as: overlays, position of page data on the form, number of copies of pages, and modification to pages.

The possible values are:

*SPLF
The value specified for Form definition (FORMDF) in the spooled file's attributes is used. CRTAFPDTA cannot use *DEVD from the spooled file's FORMDF attribute. Either change the spooled file attribute by naming a form definition or specify a form definition to CRTAFPDTA.
*INLINE
A form definition is included in the input data.
form-definition-name
Specifies the name of the form definition. This form definition must exist in the library specified. Valid values range from 1 to 8 characters.

The possible library values are:

*LIBL
All libraries in the job's library list are searched until the first match is found.
*CURLIB
The current library for the job in which the form definition is located. If no library is specified as the current library for the job, QGPL is used.
library-name
Specifies the library where the form definition is located.

If the form definition is not found when either *LIBL or *CURLIB is specified for the library, the font libraries QFNTCPL, QFNT01-QFNT19, and QFNT61-QFNT69 are searched.

Page definition (PAGDFN)

Specifies the name of the page definition to be used to format line data. This parameter is used only if the input data stream is either line (*LINE) or mixed mode (*APFDSLINE).

The possible values are:

*SPLF
The value specified for Page definition (PAGDFN) in the spooled file's attributes is used. CRTAFPDTA cannot use *DEVD from the spooled file's PAGDFN attribute. Either change the spooled file attribute by naming a page definition or specify a page definition to CRTAFPDTA.
*INLINE
A page definition is included within the input data.
page-definition-name
Specify the name of the page definition that must exist in the library specified. Valid values range from 1 to 8 characters.

The possible library values are:

*LIBL
All libraries in the job's library list are searched until the first match is found.
*CURLIB
The current library for the job in which the page definition is located. If no library is specified as the current library for the job, QGPL is used.
library-name
Specifies the library where the page definition is located.

If the page definition is not found when either *LIBL or *CURLIB is specified for the library, the font libraries QFNTCPL, QFNT01-QFNT19, and QFNT61-QFNT69 are searched.

To index stream file (TOIDXSTMF)

Specifies the stream file to which the index object file is written.

The possible values are:

*NONE
The index object information is not written to a stream file.
*DFT
The index object information is written to the file output.idx in the current working directory. If the data is being written to qsys.lib, the file name used is outputidx.mbr.
to-index-stream-file
Specifies the path name of the stream file to which the document index is written. All directories in the path name must exist. New directories are not created. If the stream file does not exist, it is created. If you specify the file name without a path, the output file is placed in your current working directory. If the file exists, it is overwritten. If you name a directory or path but not a file name, a file named output.idx is written. If the path name is qualified, it must be enclosed in apostrophes.

To resource stream file (TORSCSTMF)

Specifies the stream file to which resources are written.

The possible values are:

*NONE
Resources are not written to a stream file.
*DFT
Resources are written to the file output.rsc in the current working directory. If the data is being written to qsys.lib, the file name used is outputrsc.mbr.
to-resource-stream-file-path
Specifies the path name of the stream file to which the resource data is written. All directories in the path name must exist. New directories are not created. If the stream file does not exist, it is created. If you specify the file name without a path, the output file is placed in your current working directory. If the file exists, it will be overwritten. If you name a directory or path but not a file name, a file named of output.rsc is written. If the path name is qualified, it must be enclosed in apostrophes.

Index trigger definition (IDXTRG)

Specifies the locations and values of data fields within the input file that are to be used to define indexing groups in the file. These data fields are referred to as triggers, because their presence in the file triggers a processing action. The number of IDXTRG specifications required to uniquely identify the beginning of a group of pages within the file depends on the complexity of the application output. The first IDXTRG specification is special. Each record in the file containing the value specified in the first IDXTRG specification is referred to as an indexing anchor record.

This parameter is only valid if TOIDXSTMF has a value other than *NONE.

The possible values are:

record-number
Specifies the relative record number from the indexing anchor record. The anchor record is the first IDXTRG specification in the list of IDXTRG values. After the first IDXTRG specification has been found, all other IDXTRG specifications are specified as a relative offset from the first IDXTRG specification.

The possible values for record-number are:

record-number
A value ranging from -255 to 255.
*
This value may be specified only in the first IDXTRG specification. This special value indicates that every record should be checked for the presence of the first IDXTRG specification.
column-number
Specifies the byte offset from the beginning of the record where the IDXTRG value is located.

The possible values for column-number are:

column-number
A value ranging from 1 to 32756. A value of 1 refers to the first byte in the record. For files containing carriage control characters, column 1 refers to the carriage control character. CRTAFPDTA compares the trigger-value to the input data. If the specified value exceeds the physical length of the record, CRTAFPDTA considers the comparison "false" and continues processing.
*
The record is scanned from left to right, looking for the trigger-value.
trigger-value
Specifies the actual alphanumeric (case-sensitive) or hexadecimal value of the trigger. CRTAFPDTA does not perform any validity checking on this value, but uses it in performing a byte-for-byte comparison with the records in the file. The trigger-value can be from 1-250 bytes in length. If the combined values of column and the trigger-value length exceed the physical length of the record, CRTAFPDTA considers the comparison "false" and continues processing.

A maximum of four IDXTRG values may be specified. CRTAFPDTA will number each trigger based on the sequence in which they are specified. For example, if a message indicates an error with respect to 'Index trigger definition number 4', a reference is being made to the fourth trigger in the series of triggers you specified.

Index field definition (IDXTAGFLD)

Specifies the data fields to be used to construct the indexing information. These data fields can be specified as either literal values or CRTAFPDTA can retrieve the data from the input records of the file.

This parameter is only valid if TOIDXSTMF has a value other than *NONE.

The possible values are:

record-number or literal-value
Specifies either the relative record number from the indexing anchor record or a literal value. When CRTAFPDTA indexes a file, it uses the information specified in the IDXTRG parameters to determine a page-group boundary. When all the specified IDXTRG values are true, CRTAFPDTA defines the indexing anchor record as the record where the first IDXTRG definition is located. The first IDXTRG definition becomes the reference point from which all indexing information is located.

You may specify either a record number or literal value.

  • A record number value specifies the relative record number from the indexing anchor record. If you specify a record number, you must also specify the column and length fields. To specify a record number, enter the number without quotes.
  • A literal value specifies a constant value. Literal values do not have column or length values associated with them. You may not specify column and length values when specifying a literal value. To specify a literal numeric value, enclose the value in apostrophes. If the value begins with a non-numeric value, quotes are not needed.
column
The byte offset from the beginning of the record. A value of 1 refers to the first byte in the record. For files containing carriage control characters, column 1 refers to the carriage control character. For those applications that use a specific carriage control character to define page boundaries (for example, skip to channel 1), consider defining the value of the carriage control character as one of the IDXTRG parameters. If the specified value exceeds the physical length of the record, CRTAFPDTA reports an error condition and terminates processing.

Specify a column number only when a record number has been specified.

length
The number of contiguous byes (characters) starting at the value specified for column that compose this field.

The field can extend outside the record length, as long as the column where it begins lies within record length. In this case, CRTAFPDTA adds padding blanks (X'40') to fill out the record. If the field begins outside the maximum length of the record, CRTAFPDTA reports an error condition and terminates processing.

Specify a length only when a record number has been specified.

A maxiumum of 16 fields can be defined. Each field is numbered automatically by CRTAFPDTA based on the sequence in which you specify the values, starting with the number 1.

You may use IDXTAGFLD definitions as part of an index definition using the IDXTAG parameter. For example, if you wish to reference the third IDXTAGFLD specification when specifying an IDXTAG, then you must specify *IDXTAGFLD3.

Index tag definition (IDXTAG)

Specifies the content of the indexing tags for the entire file.

If literal values are specified for every IDXTAG specificaiton, CRTAFPDTA treats the entire file as one page group and uses this information to index the document. CRTAFPDTA stops processing the input file if literal values are specified for all IDXTAG parameters and if any IDXTRG parameters are also specified.

This parameter is only valid if TOIDXSTMF has a value other than *NONE.

The possible values are:

literal-value
Specifies a user-defined attribute name to be associated with the actual index value. For example, assume the first IDXTAG definition is a person's bank account number. The string 'account number' would be a meaningful attribute name. The value of IDXTAG would be the account number (for example, 1234567). Think of the attribute name as a label for the actual index value. The attribute name is an EBCDIC character string from 1-250 bytes in length. CRTAFPDTA does not perform any validity checking on the contents of the attribute name.
field
Specifies one or more IDXTAGFLD defininitions that compose the index value. A maximum of 16 IDXTAGFLD definitions can be specified. If more than one IDXTAGFLD definition is specified, CRTAFPDTA concatenates them into one physical string of data. No delimiters are used between the concatenated fields. Because an IDXTAG value has a maximum length of 250 bytes, the total of all specified IDXTAGFLD definitions for a single index cannot exceed this length. CRTAFPDTA reports an error condition and terminates processing if this occurs.

A maximum of 8 indexes can be defined, and each index can be made up of more IDXTAGFLD definitions.

For identification purposes, CRTAFPDTA will number each index tag based on the sequence in which they are specified. For example, if a message indicates an error with respect to 'Index tag definition number 2', a reference is being made to the second index in the series of index tags you specified. You will need to specify index tag values by number (i.e, *IDXTAG1) for the IDXGRP parameter.

Index code page identifier (IDXCDEPAG)

Specifies the code page identifier for the index values and attribute names produced by CRTAFPDTA.

This value is used by programs that must display indexing information. These programs use this value in conjunction with code page translation tables to represent the information.

This parameter is only valid if TOIDXSTMF has a value other than *NONE.

The possible values are:

500
Code page identifier 500.
code-page-identifier
A code page identifier between 1-65535.

Generate page names (IDXPAGNAM)

Specifies whether CRTAFPDTA generates page names using an 8-byte counter or uses structured field tokens found in the input data stream. If the input data contains BPGs with FQNs, CRTAFPDTA does not generate page names.

Use of this parameter requires technical knowledge of the makeup of the input file. Such users will understand the explanation of this parameter. All other users should use the default value of *GEN.

This parameter is only valid if TOIDXSTMF has a value other than *NONE.

The possible values are:

*GEN
Page names are generated using an 8-byte counter.
*FILE
Page names are generated using structured field tokens in the input data stream.

Generate group names (IDXGRPNAM)

Specifies whether CRTAFPDTA creates a unique group name by generating an 8-character numeric string and appending the string to the group name.

This parameter is only valid if TOIDXSTMF has a value other than *NONE.

The possible values are:

*YES
CRTAFPDTA generates an 8-character numeric string and appends the string to the group name.
*NO
CRTAFPDTA does not generate the string.

Select index for group names (IDXGRP)

Specifies which of the eight possible IDXTAG values should be used as the group name for each index group. Using the most unique index value for the group name is recommended. The intent is to have a unique group name for every group CRTAFPDTA produces in the output file. The value includes the IDXTAGFLD definitions from the IDXTAG parameter but does not include the attribute name.

The AFP Viewer displays this value along with the attribute name and index value. You can use the group name to select a group of pages to be viewed.

This parameter is only valid if TOIDXSTMF has a value other than *NONE.

The possible values are:

*IDXTAG1
Use the first IDXTAG value.
*IDXTAG2-*IDXTAG8
Use the specified IDXTAG value.

Information for index file (IDXOBJ)

Specifies how much information CRTAFPDTA writes to the index object file.

This parameter is only valid if TOIDXSTMF has a value other than *NONE.

The possible values are:

*GROUP
Group-level entries only are put into the index object file.
*ALL
Both page-level and group-level entries are put into the index object file. Only specify this value if you have TLEs in the input datastream. For information about TLEs, refer to AFP Toolbox for Multiple Operating Systems: User's Guide or the DDS Reference: Printer Files topic in the iSeries Information Center.

Indexing page limit (IDXPAGLMT)

Specifies the output page number by which CRTAFPDTA must find an indexing field, if CRTAFPDTA is indexing the file. If CRTAFPDTA does not find an indexing field, processing stops.

This parameter is helpful if your file contains header pages. You can specify a page number one greater than the number of header pages, so that CRTAFPDTA will continue to look for matches for the number of pages specified for this parameter.

This parameter is only valid if TOIDXSTMF has a value other than *NONE.

The possible values are:

1
An indexing field must be found in the first output page.
indexing-page-limit
Any number from 1 through 99.

Resource data (RSCDTA)

Specifies the types of resources to be written to the stream file specified on the TORSCSTMF parameter.

This parameter is only valid if TORSCSTMF has a value other than *NONE. One or more resource data types must be specified if TORSCSTMF has a value other than *NONE.

A maximum of 7 resources may be specified if you are naming specific resource types.

The possible values are:

*ALL
All resources required to print or view the output document, specified with TOSTMF, be included in the file specified with the TORSCSTMF parameter.

When *ALL is specified, you may not specify other resource types.

*BARCODE
Specifies that all BCOCA objects included by an Include Object (IOB) structured field required to print or view the output document be included in the resource stream file.
*FONT
Specifies that all font character sets, code pages and coded fonts required to print or view the output file be included in the resource stream file.
*FORMDF
Specifies that the form definition used in processing the file be included in the resource stream file.
*GOCA
Specifies that all GOCA objects included by an IOB structured field required to print or view the output document file be included in the resource stream file.
*IOCA
Specifies that all IOCA objects included by an IOB structured field required to print or view the output document file be included in the resource stream file.
*OVL
Specifies that all overlays required to print or view the output document file be included in the resource stream file.
*PAGSEG
Specifies that all page segments required to print or view the output document file be included in the resource stream file.

To merged stream file (TOMRGSTMF)

Specifies the stream file in which the following stream files are written:

Specify a stream file path if you wish to view the input spooled file, save the exact document for archival purposes or send the document to another system.

You may also specify whether the stream files which are used as input to the merged stream file are kept or deleted.

The possible values are:

Element 1: Stream File Name

*NONE
Stream files are not merged.
*DFT
Stream files will be written to file output.mrg in the current working directory. If the data is being written to qsys.lib, the file name used is outputmrg.mbr.
to-merged-stream-file-path
Specifies the path name of the stream file to which the above-mentioned stream files are written. All directories in the path name must exist. New directories are not created. If the stream file does not exist, it is created. If you specify the file name without a path, the output file is placed in your current working directory. If the file exists, it will be overwritten. If the file exists, it will be overwritten. If you name a directory or path but not a file name, a file named output.mrg is written. If the path name is qualified, it must be enclosed in apostrophes.

Element 2: Keep or Delete Input Files

*KEEPINPUT
No input stream files are deleted.
*DLTINPUT
The stream files used as input for the merged stream file will be deleted after the merged stream file has been written.

AFP characters (AFPCHARS)

Specifies one or more AFP characters (coded fonts) to be used with line data and a page definition.

The possible values are:

*SPLF
The value for AFP characters as specified in the spooled file attributes for the named spooled file will be used.
coded-font
Specify up to four 4-byte names. The 4-byte names are concatenated to 'X0' to identify up to four coded fonts which are to be used when Table reference characters (TBLREFCHR) are being used within the data.
*NONE
No AFP characters (coded fonts) specified.

Image output (IMAGEOUT)

Specifies the format of the image data produced by CRTAFPDTA in the output document.

The possible values are:

*ASIS
Image data is output exactly as in the input file.
*IOCA
All image data is output in uncompressed IOCA format.

Examples

None

Error messages

*ESCAPE Messages

IPS301E
CRTAFPDTA command terminated with errors.