IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

z/OS Discussion :

Tri sur un fichier Variable Bloqué


Sujet :

z/OS

  1. #1
    Membre habitué
    Homme Profil pro
    Développeur COBOL
    Inscrit en
    Janvier 2003
    Messages
    339
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 43
    Localisation : France, Loire Atlantique (Pays de la Loire)

    Informations professionnelles :
    Activité : Développeur COBOL
    Secteur : Finance

    Informations forums :
    Inscription : Janvier 2003
    Messages : 339
    Points : 184
    Points
    184
    Par défaut Tri sur un fichier Variable Bloqué
    Bonjour, je suis confronté à un soucis, je souhaite trier un fichier variable contenant à la position 540 (sans compter les 4 octets de départ) le nombre 20041.

    J'utilise dans mon JCL la commande suivante :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    SORT FIELDS=COPY
    INCLUDE COND=(544,3,BI,EQ,X'20041C')
    La definition du fichier de sortie est la suivante :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    DCB=(RECFM=VB,LRECL=1604,DSORG=PS)
    Le fichier en entrée est un VB de taille 1604.

    Le problème que je rencontre est le suivant :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    ICE218A 6 204 BYTE VARIABLE RECORD IS SHORTER THAN 542 BYTE MINIMUM FOR FIELDS
    Je comprend bien son libellé mais je vois pas comment le contourner ... Avez vous une solution ?

    Merci
    « Ne me faites pas d'objections.
    Les difficultés en feront assez d'elles-mêmes. »

    sir Winston Churchill

  2. #2
    Membre confirmé Avatar de Homer-ac
    Profil pro
    Inscrit en
    Octobre 2007
    Messages
    449
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Octobre 2007
    Messages : 449
    Points : 586
    Points
    586
    Par défaut
    En dehors de la solution la plus évidente de passer apres un sort fields=copy intermédiaire et une OMIT COND= pour supprimer les enregistements non concernés, éventuellement difficiles à détecter sans tatonner un peu, le plus simple me semble être de passer en FB avec un LRECL maxi sur un fichier intermédiaire en précisant juste SORT FIELDS=COPY,FORMAT puis reprendre l'extraction sur ce fichier.

  3. #3
    Membre expert
    Homme Profil pro
    Retraité
    Inscrit en
    Octobre 2005
    Messages
    1 473
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 65
    Localisation : France, Seine Saint Denis (Île de France)

    Informations professionnelles :
    Activité : Retraité
    Secteur : Finance

    Informations forums :
    Inscription : Octobre 2005
    Messages : 1 473
    Points : 3 283
    Points
    3 283
    Par défaut
    D'après la doc sur les messages d'erreur du SORT on a :

    ICE218A n BYTE VARIABLE RECORD IS SHORTER THAN m BYTE MINIMUM FOR [ddname]
    FIELDS

    Explanation: Critical. A variable-length record was shorter than 4 bytes, or was too short to contain all specified fields. The values shown in the message are as follows:

    n is the length of the variable-length record
    m is 4 or the minimum length needed for all fields specified
    if ddname is blank, the short record was detected during non-OUTFIL processing. Otherwise, the first data set in the OUTFIL group for which the short record was detected is indicated by ddname.
    System Action: The program terminates.

    Programmer Response: If a variable-length record was too short to contain all INREC, OUTREC, or OUTFIL fields, use an INREC or OUTREC statement with operands OVERLAY or IFTHEN as appropriate, or an OUTFIL statement with operands OVERLAY, IFTHEN, or BUILD and VLFILL=C 'x' or VLFILL=X 'yy' as appropriate, to prevent DFSORT from terminating.

    If the variable-length record was too short to contain all SORT, MERGE, or SUM fields, use the VLSHRT option to prevent DFSORT from terminating.

    If a variable-length record was too short to contain all INCLUDE or OMIT fields, use the VLSCMP or VLSHRT option to prevent DFSORT from terminating.

    See the Programmer Response for message ICE015A for additional information.
    Je pense que l'enregistrement en cours de traitement est plus court que la zone utilisée pour le INCLUDE.

    Comme le dit la doc, peut-être faudrait-il essayer l'option VLSCMP ou VLSHRT ...

  4. #4
    Membre confirmé Avatar de Homer-ac
    Profil pro
    Inscrit en
    Octobre 2007
    Messages
    449
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Octobre 2007
    Messages : 449
    Points : 586
    Points
    586
    Par défaut
    Oups et re oups ! SORT FIELDS=COPY,CONVERT (option CONVERT, pas FORMAT bien évidemment pour passer en fixe)
    Sans quoi Luc Orient à raison pour l'OPTION VLSCMP. A passer juste avant l'INCLUDE COND= ça va padder à zéros binaires avant et c'est effectivement le plus simple.

  5. #5
    Membre habitué
    Homme Profil pro
    Développeur COBOL
    Inscrit en
    Janvier 2003
    Messages
    339
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 43
    Localisation : France, Loire Atlantique (Pays de la Loire)

    Informations professionnelles :
    Activité : Développeur COBOL
    Secteur : Finance

    Informations forums :
    Inscription : Janvier 2003
    Messages : 339
    Points : 184
    Points
    184
    Par défaut
    Merci, j'ai testé la SYSIN suivante :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    SORT FIELDS=(540,3,BI,A)
    INCLUDE COND=(540,3,BI,EQ,X'20041C')
    OPTION VLSHRT
    Le JCL fonctionne bien

    Pouvez vous m'expliquer la signification de ces deux options (VLSHRT qui, si j'ai bien compris rempli de 0 binaire de facon a atteindre la taille minimale et VLSCMP)


    Merci pour votre aide
    « Ne me faites pas d'objections.
    Les difficultés en feront assez d'elles-mêmes. »

    sir Winston Churchill

  6. #6
    Membre confirmé Avatar de Homer-ac
    Profil pro
    Inscrit en
    Octobre 2007
    Messages
    449
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Octobre 2007
    Messages : 449
    Points : 586
    Points
    586
    Par défaut
    VSLHRT va permettre d'ignorer les enreg. trop courts (jamais utilisé non plus)
    VLSCMP va forcer les comparaisons critères avec padding à x'00'
    Il y a ce PDF que je trouve pas mal parce qu'il est court, la doc DFSORT étant plus recommandable comme chevet que comme livre de chevet.

    http://www-304.ibm.com/systems/suppo...f/sortaskp.pdfs

  7. #7
    Membre habitué
    Homme Profil pro
    Développeur COBOL
    Inscrit en
    Janvier 2003
    Messages
    339
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 43
    Localisation : France, Loire Atlantique (Pays de la Loire)

    Informations professionnelles :
    Activité : Développeur COBOL
    Secteur : Finance

    Informations forums :
    Inscription : Janvier 2003
    Messages : 339
    Points : 184
    Points
    184
    Par défaut
    Merci pour la doc !

    Je m'en fais de suit un livret perso ...

    @+
    « Ne me faites pas d'objections.
    Les difficultés en feront assez d'elles-mêmes. »

    sir Winston Churchill

  8. #8
    Membre expert
    Homme Profil pro
    Retraité
    Inscrit en
    Octobre 2005
    Messages
    1 473
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 65
    Localisation : France, Seine Saint Denis (Île de France)

    Informations professionnelles :
    Activité : Retraité
    Secteur : Finance

    Informations forums :
    Inscription : Octobre 2005
    Messages : 1 473
    Points : 3 283
    Points
    3 283
    Par défaut
    Il suffit de lire la doc jeune padawan ...

    VLSCMP :
    VLSCMP or NOVLSCMP
    _____________________________________________________________________
    | |
    | >>__ _VLSCMP___ ________________________________________________>< |
    | |_NOVLSCMP_| |
    | |
    |_____________________________________________________________________|

    Temporarily overrides the VLSCMP installation option, which specifies whether DFSORT is to pad "short" variable-length INCLUDE/OMIT compare fields with binary zeros. A short field is one where the variable-length record is too short to contain the entire field, that is, the field extends beyond the record. VLSCMP and NOVLSCMP apply to the INCLUDE and OMIT statements and to the INCLUDE and OMIT parameters of the OUTFIL statement.

    The compare fields are only padded temporarily for testing; they are not actually changed for output.

    VLSCMP is not meaningful for fixed-length record processing.

    The settings for VLSCMP/NOVLSCMP and VLSHRT/NOVLSHRT provide three levels of processing for short INCLUDE/OMIT fields in the following hierarchy:

    VLSCMP allows all of the INCLUDE/OMIT comparisons to be performed even if some fields are short. Because short fields are padded with binary zeros, comparisons involving short fields are false (unless a test against binary zero is relevant, as discussed below). Comparisons involving non-short fields can be true or false.

    NOVLSCMP and VLSHRT treat the entire INCLUDE/OMIT logical expression as false if any field is short. Thus comparisons involving non-short fields are ignored if any comparison involves a short field.

    NOVLSCMP and NOVLSHRT result in termination if any field is short.

    To illustrate how this works, suppose the following INCLUDE statement is used:

    INCLUDE COND=(6,1,CH,EQ,C'1',OR,70,2,CH,EQ,C'T1')

    If a variable-length input record has a length less than 71 bytes, the field at bytes 70-71 is short and the following occurs:

    With VLSCMP, the record is included if byte 6 of the input record is C'1' or omitted if byte 6 is not C'1'. The comparison of bytes 70-71 equal to C'T1' is false because bytes 70-71 contain either X'hh00' (for a record length of 70 bytes) or X'0000' (for a record length of less than 70 bytes). The comparison involving the non-short field is performed even though a short field is present.

    With NOVLSCMP and VLSHRT, the record is omitted because any short field makes the entire logical expression false. The comparison involving the non-short field is not performed because a short field is present.

    With NOVLSCMP and NOVLSHRT, DFSORT terminates because any short field results in termination.

    In general, comparisons involving short fields are false with VLSCMP. However, if a binary zero value is relevant to the comparison, the use of binary zeros for padding might make the comparison true. For example, suppose the following INCLUDE statement is used:

    INCLUDE COND=(21,2,CH,EQ,C'JX',OR,
    (55,2,CH,EQ,58,2,CH,AND,
    70,1,BI,LT,X'08'))

    If a variable-length input record has a length less than 70 bytes, the field at byte 70 is short and is padded to X'00'. This makes the comparison of byte 70 less than X'08' true even though byte 70 is a short field and so probably irrelevant.
    Likewise, if a variable-length record has a length less than 55 bytes, the fields at bytes 55-56 and 58-59 are short and are each padded to X'0000', and the field at byte 70 is short and is padded to X'00'. This makes the comparison of bytes 55-56 equal to 58-59 true and the comparison of byte 70 less than X'08' true even though all three fields are short and probably irrelevant.

    In such cases where padding of short fields with binary zeros may result in unwanted true comparisons, you can get the result you want by adding an appropriate check of the record length to the INCLUDE/OMIT logical expression, such as:

    INCLUDE COND=(21,2,CH,EQ,C'JX',OR,
    (1,2,BI,GE,X'0046',AND,
    55,2,CH,EQ,58,2,CH,AND,
    70,1,BI,LT,X'08'))

    Now the comparisons involving bytes 55-56, 58-59 and 70 can only be true for records that are 70 bytes (X'0046') or longer. Thus, the irrelevant comparisons involving short fields are eliminated.

    Keep in mind that short compare fields are padded with zeros when VLSCMP is in effect and code your INCLUDE/OMIT logical expressions to allow for that or even take advantage of it.

    VLSCMP
    specifies that short variable-length compare fields are padded with binary zeros.

    NOVLSCMP
    specifies that short variable-length compare fields are not padded.

    Default: Usually the installation default. See Appendix B, "Specification/Override of DFSORT Options" in topic B.0 for full override details.

    Applicable Functions: See Appendix B, "Specification/Override of DFSORT Options" in topic B.0.
    VLSHRT :
    VLSHRT or NOVLSHRT
    _____________________________________________________________________
    | |
    | >>__ _VLSHRT___ ________________________________________________>< |
    | |_NOVLSHRT_| |
    | |
    |_____________________________________________________________________|

    Temporarily overrides the VLSHRT installation option, which specifies whether DFSORT is to continue processing if a "short" variable-length SORT/MERGE control field, INCLUDE/OMIT compare field, or SUM summary field is found. A short field is one where the variable-length record is too short to contain the entire field, meaning that the field extends beyond the record. VLSHRT applies to the SORT, MERGE, INCLUDE, OMIT and SUM statements, and to the INCLUDE and OMIT parameters of the OUTFIL statement.
    VLSHRT processing is not meaningful for fixed-length record processing.

    The way in which DFSORT processes short INCLUDE/OMIT compare fields depends on the settings for VLSCMP/NOVLSCMP and VLSHRT/NOVLSHRT. For details, see the discussion of the VLSCMP and NOVLSCMP options.

    VLSHRT
    specifies that DFSORT continues processing if a short control field, compare field or summary field is found.

    NOVLSHRT
    specifies that DFSORT terminates if a short control field, compare field or summary field is found.

    Notes:

    1. VLSHRT is not used if an INREC or OUTREC statement is specified, if you have an EFS01 or EFS02 routine, or if locale processing is used for SORT or MERGE fields. Note that none of these situations prevents the use of VLSCMP.

    2. Unlike the OUTREC statement, the OUTREC , BUILD, OVERLAY, or IFTHEN parameter of the OUTFIL statement does not force NOVLSHRT. Thus, you can use VLSHRT with OUTFIL to eliminate records with the INCLUDE or OMIT parameter and reformat the remaining records with the OUTREC, , BUILD, OVERLAY, or IFTHEN parameter. If a short OUTFIL OUTREC or BUILD field is found, DFSORT terminates (even if VLSHRT is in effect) unless the VLFILL=byte parameter of OUTFIL is specified. If a short OUTFIL OVERLAY or IFTHEN field is found, DFSORT pads the missing bytes with blanks so it can be processed.

    3. If VLSHRT is in effect and Blockset is selected:

    DFSORT pads short SORT or MERGE control fields with binary zeros, thus making the order predictable for records with equal control fields of different lengths. The control fields are only padded temporarily for collation; they are not actually changed for output. Padding may increase the amount of work space required.

    Records with short SUM summary fields are excluded from summation; that is, if either one of a pair of records being summed has a short SUM field, the records are left unsummed and neither record is deleted.


    4. If VLSHRT is in effect and Blockset is not selected:

    DFSORT terminates if the first byte of the first (major) SORT or MERGE control field is not included in the record.

    DFSORT does not pad short SORT or MERGE control fields, thus making the order unpredictable for records with equal control fields of different lengths.

    In certain cases, VLSHRT is not used because of the number and position of the SORT or MERGE control fields.

    EQUALS is not used.

    Tip: You can use a SORTDIAG DD statement to force message ICE800I, which gives a code indicating why Blockset could not be used.

    Default: Usually the installation default. See Appendix B, "Specification/Override of DFSORT Options" in topic B.0 for full override details.

    Applicable Functions: See Appendix B, "Specification/Override of DFSORT Options" in topic B.0.
    Source :
    z/OS DFSORT Application Programming Guide

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. [WD17] tri sur table fichier par programmation
    Par hadaf dans le forum WinDev
    Réponses: 1
    Dernier message: 12/10/2012, 14h34
  2. [FTP] fopen sur fichier distant bloqué
    Par benton_fr dans le forum Langage
    Réponses: 2
    Dernier message: 23/04/2008, 12h33
  3. [WD10] un simple tri sur un fichier
    Par yann_72 dans le forum WinDev
    Réponses: 9
    Dernier message: 05/02/2008, 09h29
  4. [BATCH] Tri sur les dates de fichiers
    Par tonf dans le forum Windows
    Réponses: 1
    Dernier message: 26/04/2007, 16h25
  5. [VBA-E] Macro Pour Faire un Tri sur plage variable
    Par tabarly35 dans le forum Macros et VBA Excel
    Réponses: 1
    Dernier message: 19/09/2006, 19h02

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo