0

入力ファイルから以下のINCLUDE基準に応じて3つのアウトファイルを作成したいと思います。さらに、以下の3つのBUILDで指定された出力ファイルのレコードの一部のみが必要です。

今の問題は、複数のBUILD/OUTRECがあると重複エラーが発生することだと思います。

JCLで同じことを達成する他の方法はありますか?

SORT  FIELDS=COPY                                              
OUTFIL FILES=01,                                               
   INCLUDE=(38,8,CH,EQ,C'AMSAM00'),                            
   BUILD=(1,4,5:366,8)                                         
OUTFIL FILES=02,                                               
   INCLUDE=(38,8,CH,EQ,C'AMSAM00',AND,390,1,CH,EQ,C'Y'),       
   BUILD=(1,4,5:382,8)                                         
OUTFIL FILES=03,                                               
   INCLUDE=(38,8,CH,EQ,C'AMSAM00',AND,545,4,CH,NE,C'0000'),    
   BUILD=(1,4,5:C'013,',9:545,4) 
4

2 に答える 2

1

This got a random poke, so...

Deuian I think was on the right lines, but left some complication and for user change didn't use the correct positions or type of output file, so would have been too much typing to apply to the situation...

OPTION COPY                                              
INCLUDE COND=(38,8,CH,EQ,C'AMSAM00')

OUTFIL FILES=02,                                               
  INCLUDE=(390,1,CH,EQ,C'Y'),       
  BUILD=(1,4,382,8)                                         

OUTFIL FILES=03,                                               
  INCLUDE=(545,4,CH,NE,C'0000',
          AND,390,1,CH,NE,C'Y'),    
  BUILD=(1,4,C'013,',545,4) 

OUTFIL FILES=01,SAVE,
  BUILD=(1,4,366,8)                                         

This presumes that SORTOUT will not be needed (it would just be a copy of the input file).

All the AMSAM00 records are INCLUDED, everything else (which is unwanted for the OUTFILs) is ignored.

OUTFIL 02 gets all the 'Y's.

OUTFIL 03 gets all the not 0000s which are not 'Y'

OUTFIL 01, moved to make it easier to follow, gets all the records which are not selected on another OUTFIL (by using SAVE).

All of the data which passes the INCLUDE will be on one of the three OUTFILs, and only one.

I have used OPTION COPY for clarity. SORT FIELDS=(... logically appears after the INCLUDE (wherever you code it) and by using OPTION COPY it is clear, up front, and in a logical place, that it is a COPY operation.

I have taken out the "columns" from the BUILDs (those numbers followed by a colon). If the data is going into that column automatically (which it is), then using the columns only creates work, introduces a new possibility of error, and makes the Sort Control Cards more difficult to maintain.

The question is unclear, so this is just a guess at what was wanted.

There was mention of OUTREC.

From the context, this is OUTREC on OUTFIL. There is a separate OUTREC statement. To avoid confusion (due to the "overloading" of OUTREC), don't use OUTREC on OUTFIL, which is for "backwards compatability", use the modern BUILD instead, which is entirely equivalent.

BUILD exists on INREC, OUTREC and OUTFIL, separately and as part of an IFTHEN. OUTREC as equivalent of BUILD is only on OUTFIL.

On INREC and OUTREC, FIELDS also has the "overloading" for the same reason (the backwards thing).

Don't use INREC FIELDS=, or OUTREC FIELDS= or OUTFIL OUTREC=, use BUILD in their place.

于 2013-04-06T01:49:10.823 に答える
0

以下は、あなたがやろうとしていることだと思います。インクルード 1 は、インクルード 2 と 3 が選択するものを除外します。同様に、インクルード 2 は、1 と 3 が選択するものを除外します。インクルード 3 は、1 と 2 のインクルードを除外する以外は同じことをしています。

各 FILE DD には下から 1 つのレコードのみがあり、すべてのレコードがソートアウトにコピーされます

//SORTIN  DD *
AMSAM00Y0000
AMSAM00N0001
AMSAM00Y0001
AMSAM00N0000
//SORTOUT DD SYSOUT=*
//SYSIN    DD *
  SORT  FIELDS=COPY
     OUTFIL FNAMES=FILE1,
        INCLUDE=(1,7,CH,EQ,C'AMSAM00',
                 AND,8,1,CH,NE,C'Y',AND,9,4,CH,EQ,C'0000'),
        BUILD=(1,12)
     OUTFIL FNAMES=FILE2,
        INCLUDE=(1,7,CH,EQ,C'AMSAM00',AND,
                 8,1,CH,EQ,C'Y',AND,
                 9,4,CH,EQ,C'0000'),
        BUILD=(1,12)
     OUTFIL FNAMES=FILE3,
        INCLUDE=(1,7,CH,EQ,C'AMSAM00',AND,
                 8,1,CH,NE,C'Y',AND,
                 9,4,CH,NE,C'0000'),
        BUILD=(1,12)


FIlE1
AMSAM00N0000

FILE2
AMSAM00Y0000

FILE3
AMSAM00N0001

SORTOUT
AMSAM00Y0000
AMSAM00N0001
AMSAM00Y0001
AMSAM00N0000
于 2012-07-15T18:49:12.107 に答える