OPALE - 10.0 - Utilisation - Repagination d'un fichier spool IBM-i/en

Différence entre versions

De MappingDoc
(Page créée avec « This command reads the content of physical file MYPF and creates a new spooled file (MYREPORT) with a page break every 10 lines. »)
 
(6 révisions intermédiaires par le même utilisateur non affichées)
Ligne 8 : Ligne 8 :
 
==Commands==
 
==Commands==
 
===MAPSORTPAG===
 
===MAPSORTPAG===
As explained above, MAPSORTPAG is used to put the content of the file into a database file.
+
As explained above, in this case MAPSORTPAG is used to put the content of the file into a database file.
  
 
As an example, here is a spooled file we want to repaginate:
 
As an example, here is a spooled file we want to repaginate:
  
Spooled file name  . . . . . . . > A000000002 <br>
+
Spooled file name  . . . . . . . > A000000002
Spooled file number  . . . . . . > 3 <br>       
+
Spooled file number  . . . . . . > 3
Job name . . . . . . . . . . . . > QPADEV0008 <br>
+
Job name . . . . . . . . . . . . > QPADEV0008
Job number . . . . . . . . . . . > 487312   <br>  
+
Job number . . . . . . . . . . . > 487312   
User . . . . . . . . . . . . . . > JDIEU   <br>    
+
User . . . . . . . . . . . . . . > JDIEU   
  
 
<u>Run this command</u>:
 
<u>Run this command</u>:
Ligne 74 : Ligne 74 :
 
This command reads the content of physical file MYPF and creates a new  spooled file (MYREPORT) with a page break every 10 lines.
 
This command reads the content of physical file MYPF and creates a new  spooled file (MYREPORT) with a page break every 10 lines.
  
<u>Remarque</u> : Pour avoir un spooled file avec un saut de page toutes les 20 lignes, il faut changer la valeur TOTLINE à 20.
+
<u>Note</u>: To have a page break every 20 lines, set the value of TOTLINE to 20.
  
==Exécution sur le serveur==
+
==Execution on the Server==
  
Afin d'automatiser l'exécution sur le serveur, il est nécessaire de créer une entrée dans les règles appelant une action incluant les 2 commandes vues ci-dessus :
+
To automate execution on the server, an action must be created in the rules including both commands as seen previously:
  
 
  MAPSORTPAG SPLF(&SPLF) SPLNUM(&SPLNUM) JOB(&JOB) JOBNUM(&JOBNUM) USER(&USER) KEYLINE(1) KEYCOL(1) KEYLGN(1) CREATE(*NO) LIB(MAP$$SORT) NAME(MYPF)
 
  MAPSORTPAG SPLF(&SPLF) SPLNUM(&SPLNUM) JOB(&JOB) JOBNUM(&JOBNUM) USER(&USER) KEYLINE(1) KEYCOL(1) KEYLGN(1) CREATE(*NO) LIB(MAP$$SORT) NAME(MYPF)
 
  MAPRUNRPT RPTNAM(NEWPAG) SPOOLFILE(MYREPORT) OUTQ(LIBOUTQ/MYOUTQ)PARM('DB.TOTLINE=10')
 
  MAPRUNRPT RPTNAM(NEWPAG) SPOOLFILE(MYREPORT) OUTQ(LIBOUTQ/MYOUTQ)PARM('DB.TOTLINE=10')

Version actuelle datée du 4 décembre 2019 à 09:29

Autres langues :
English • ‎français

Introduction

The objective of this use case is to explain how to repaginate an IBM i spooled file.

To do this, two commands need to be used: MAPSORTPAG and MAPRUNRPT (M-Connect). MAPSORTPAG puts the content of the spooled file into a physical file, and then MAPRUNRPT reads the physical file and recreates a spooled file with the desired pagination.
Example: A page break every 20 lines passed as a parameter in MAPRUNRPT.

Commands

MAPSORTPAG

As explained above, in this case MAPSORTPAG is used to put the content of the file into a database file.

As an example, here is a spooled file we want to repaginate:

Spooled file name  . . . . . . . > A000000002
Spooled file number  . . . . . . > 3
Job name . . . . . . . . . . . . > QPADEV0008
Job number . . . . . . . . . . . > 487312  
User . . . . . . . . . . . . . . > JDIEU   

Run this command:

MAPSORTPAG SPLF(A000000002) SPLNUM(3) JOB(QPADEV0008) JOBNUM(487312) USER(JDIEU) KEYLINE(1) KEYCOL(1) KEYLGN(1) CREATE(*NO) LIB(MAP$$SORT) NAME(MYPF)

The spooled file content is now added to physical file MAP$$SORT/MYPF in the database

MAPRUNRPT

This command runs a Connect which reads the physical file MYPF and creates a spooled file with the new pagination information.

Connect Project

Creating the Connect project
  1. Create a new Connect project
  2. Change the name of the format. Click on Properties and call it NEWPAG
  3. Click on Insert table (.def)
  4. Browse to the .def file created previously on Opale Server (this will create a Connect table automatically)
  5. Click on the Spooled file button (on the vertical bar on the left)
  6. Click on New Block
  7. Call the block MYBLOCK
  8. Drag and drop the field PRTDTA from the MYPF table on to the block
  9. Create 2 variables in the DB table: LINE# and TOTLINE (TOTLINE should be defined as an Input Parameter)
  10. In the actions of the MYPF table, enter the actions to get the result below:
  11. Click on Preview , enter 10 for the value of DB.TOTLINE and check that the content of the PF is written with the expected number of lines

Preview:

As you can see, the newly generated spooled file has only 10 lines (value specified in parameter TOTLINE when generating the preview)

General Connect project

DB table window (the content of ACTION will be executed when the Connect is run)


MYPF table window (the content of MYPF will be executed when the Connect is run at the Execute MYPF level)

The Read MYPF instruction reads the first line of the MYPF physical file. For the current line, the Connect engine will:

  1. Write block MYBLOC via the Write MYPF : MYBLOC instruction (Connect block containing the value of current record MYPF)
  2. Increment the number of lines counter (DB.LINE# variable declared in DB table)
  3. Check the value: If the current line number is equal to the value passed as a parameter for the desired number of lines, then Connect inserts a page break instruction and then the counter is reset to 0.
  4. Read the next record in MYPF using the Next Read instruction
Executing Connect on the server

After the Connect has been generated and imported on to the Opale Server, you can run the command below:

MAPRUNRPT RPTNAM(NEWPAG) SPOOLFILE(MYREPORT) OUTQ(LIBOUTQ/MYOUTQ)PARM('DB.TOTLINE=10')

This command reads the content of physical file MYPF and creates a new spooled file (MYREPORT) with a page break every 10 lines.

Note: To have a page break every 20 lines, set the value of TOTLINE to 20.

Execution on the Server

To automate execution on the server, an action must be created in the rules including both commands as seen previously:

MAPSORTPAG SPLF(&SPLF) SPLNUM(&SPLNUM) JOB(&JOB) JOBNUM(&JOBNUM) USER(&USER) KEYLINE(1) KEYCOL(1) KEYLGN(1) CREATE(*NO) LIB(MAP$$SORT) NAME(MYPF)
MAPRUNRPT RPTNAM(NEWPAG) SPOOLFILE(MYREPORT) OUTQ(LIBOUTQ/MYOUTQ)PARM('DB.TOTLINE=10')