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

Différence entre versions

De MappingDoc
(Page créée avec « #Create a new Connect project #Change the name of the format. Click on '''Properties''' and call it '''NEWPAG''' #Click on '''Insert table (.def)''' #Browse to the .def fi... »)
 
(15 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 43 : Ligne 43 :
 
#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
 
#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
  
<u>Exemple de preview</u> :
+
<u>Preview</u>:
 
[[Fichier:OP_S_PAG_3.jpg|vignette|1000x1000px|alt=|néant]]
 
[[Fichier:OP_S_PAG_3.jpg|vignette|1000x1000px|alt=|néant]]
Nous pouvons constater que notre spooled file généré comporte bien uniquement 10 lignes. (valeur spécifiée dans le paramètre TOTLINE lors du lancement de la preview)
+
As you can see, the newly generated spooled file has only 10 lines (value specified in parameter TOTLINE when generating the preview)
  
=====Fonctionnement général du projet Connect=====
+
=====General Connect project=====
  
Fenêtre de la table DB. (ce qui se trouve dans ACTION sera exécuté lors de l'exécution du Connect)
+
DB table window (the content of ACTION will be executed when the Connect is run)
  
 
[[Fichier:OP_S_PAG_1.jpg|vignette|450x450px|alt=|néant]]
 
[[Fichier:OP_S_PAG_1.jpg|vignette|450x450px|alt=|néant]]
Ligne 55 : Ligne 55 :
  
  
Fenêtre de la table MYPF. (ce qui se trouve dans MYPF sera exécuté lors de l'exécution du Connect au niveau du '''Execute MYPF''')
+
MYPF table window (the content of MYPF will be executed when the Connect is run at the '''Execute MYPF''' level)
  
 
[[Fichier:OP_S_PAG_2.jpg|vignette|450x450px|alt=|néant]]
 
[[Fichier:OP_S_PAG_2.jpg|vignette|450x450px|alt=|néant]]
  
Le '''Read MYPF''' lit la première ligne du fichier physique MYPF. Pour cette ligne en cours, le moteur Connect va :
+
The '''Read MYPF''' instruction reads the first line of the MYPF physical file. For the current line, the Connect engine will:
  
#Ecrire le BLOC MYBLOC via le '''Write MYPF : MYBLOC''' (bloc Connect contenant la valeur de l'enregistrement de MYPF en cours)
+
#Write block MYBLOC via the '''Write MYPF : MYBLOC''' instruction (Connect block containing the value of current record MYPF)
#Incrémenter le compteur de nombre de ligne (Variable DB.LINE# déclaré dans la table DB)
+
#Increment the number of lines counter (DB.LINE# variable declared in DB table)
#Vérifier sa valeur : Si le numéro de ligne en cours est égale à la valeur passé en paramètre pour le nombre de ligne souhaité alors Connecte fera un saut de page (instruction page break) et ensuite on met ce compteur à 0.
+
#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.
#Passer au prochain enregistrement de MYPF grâce à l'instruction '''Next Read'''
+
#Read the next record in MYPF using the '''Next Read''' instruction
  
=====Exécution du Connect sur le serveur=====
+
=====Executing Connect on the server=====
  
Une fois le Connect généré et importé sur le serveur Opale, il faut exécuter la commande suivante :
+
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')
 
  MAPRUNRPT RPTNAM(NEWPAG) SPOOLFILE(MYREPORT) OUTQ(LIBOUTQ/MYOUTQ)PARM('DB.TOTLINE=10')
  
L'exécution de cette commande a pour effet de lire le contenu du fichier physique MYPF et de créer un nouveau spooled file (MYREPORT) ayant un saut de page toutes les 10 lignes.
+
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')