IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Header + sum + trailer of SUM in a signle step


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Searchman

New User


Joined: 28 Dec 2006
Posts: 80
Location: France

PostPosted: Fri Jan 16, 2009 12:38 am
Reply with quote

Is it possible to do this in a single step ?
else, what is the best solution ?

FICIN and FICOUT are VB file

FICIN
S01ENTETE
02XX000010000200003
02XX000010000200003
02YY000010000200003
S99000003

Gives

FICOUT
S01ENTETE
02XX000020000400006
02YY000010000200003
S99000002

S01ENTETE is copied idem
Enreg 02 are summed on key XX/YY (pos 4-5)
the trailer of FICOUT (compared to FICIN) changes, it gives the number of records after sum
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Fri Jan 16, 2009 1:50 am
Reply with quote

You can use a DFSORT job like the following to do what you asked for:

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD *
S01ENTETE
 02XX000010000200003
 02XX000010000200003
 02YY000010000200003
S99000003
/*
//SORTOUT DD SYSOUT=*
//SYSIN    DD    *
  OMIT COND=(2,2,CH,EQ,C'99')
  SORT FIELDS=(2,4,CH,A)
  SUM FIELDS=(6,5,ZD,11,5,ZD,16,5,ZD)
  OUTFIL REMOVECC,
    TRAILER1=(C'S99',COUNT-1=(M11,LENGTH=6))
/*
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Fri Jan 16, 2009 11:34 am
Reply with quote

Searchman wrote:
FICIN and FICOUT are VB file
Frank,

Should n't we consider the RDW field as the OP's requirement is regarding VB files?
Back to top
View user's profile Send private message
Searchman

New User


Joined: 28 Dec 2006
Posts: 80
Location: France

PostPosted: Fri Jan 16, 2009 3:16 pm
Reply with quote

Yes, arcvns,

in the sample of Franck, I think the recsize is the same for all records

But, in my case, first and trailer records are 9 long, and detail record is 20 long, so, it makes some problem with sort sum
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Fri Jan 16, 2009 9:05 pm
Reply with quote

Oh, I missed the part where you said it was VB (it didn't help that you gave the positions of the key as 4-5 instead of 8-9). Here's a revised DFSORT job for VB.

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input file (VB)
//SORTOUT DD DSN=...  output file (VB)
//SYSIN    DD    *
  OMIT COND=(6,2,SS,EQ,C'01,99')
  SORT FIELDS=(8,2,CH,A)
  SUM FIELDS=(10,5,ZD,15,5,ZD,20,5,ZD)
  OUTFIL REMOVECC,
    HEADER1=(C'S01ENTETE'),
    TRAILER1=(C'S99',COUNT=(M11,LENGTH=6))
/*
Back to top
View user's profile Send private message
Searchman

New User


Joined: 28 Dec 2006
Posts: 80
Location: France

PostPosted: Sat Jan 17, 2009 12:19 am
Reply with quote

Sorry, but the header must be the header of FICIN and not a contant, it is unforeseeable...
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Sat Jan 17, 2009 12:42 am
Reply with quote

Ok, then try this:

Code:

  OPTION VLSHRT                               
  OMIT COND=(6,2,CH,EQ,C'99')                 
  SORT FIELDS=(6,4,CH,A)                       
  SUM FIELDS=(10,5,ZD,15,5,ZD,20,5,ZD)         
  OUTFIL REMOVECC,                             
    TRAILER1=(C'S99',COUNT-1=(M11,LENGTH=6))   
Back to top
View user's profile Send private message
Searchman

New User


Joined: 28 Dec 2006
Posts: 80
Location: France

PostPosted: Sat Jan 17, 2009 12:56 am
Reply with quote

Thank you for your quick reply, exactly what I wanted !

Interesting, I didn't know this option VLSHRT
Back to top
View user's profile Send private message
Searchman

New User


Joined: 28 Dec 2006
Posts: 80
Location: France

PostPosted: Mon Jan 19, 2009 7:16 pm
Reply with quote

In application of this solution I want to add a build, i.e keep only 330 bytes of the 346 of FICIN, header and trailer remaining the same

First, I coded that :
Code:

OPTION VLSHRT
OMIT COND=(5,3,CH,EQ,C'S99')
SUM  FIELDS=(53,10,63,10,73,10,83,10,93,10,103,10,113,10,123,10,
             133,10,143,10,153,10),FORMAT=PD
SORT FIELDS=(18,12,BI,A,325,26,CH,A)
OUTFIL REMOVECC,
   TRAILER1=(C'S99',COUNT-1=(M11,LENGTH=9)),
   BUILD=(1,330)


But the result was :
Code:

ICE210I 0 SORTOUT  : BSAM USED, LRECL = 330, BLKSIZE = 27966, TYPE = VB   (SDB)
ICE218A 3 15 BYTE VARIABLE RECORD IS SHORTER THAN 330 BYTE MINIMUM FOR SORTOUT


So, I coded that to distinguish header from detail record

Code:

OPTION VLSHRT
OMIT COND=(5,3,CH,EQ,C'S99')
SUM  FIELDS=(53,10,63,10,73,10,83,10,93,10,103,10,113,10,123,10,
             133,10,143,10,153,10),FORMAT=PD
SORT FIELDS=(18,12,BI,A,325,26,CH,A)
OUTFIL REMOVECC,
   TRAILER1=(C'S99',COUNT-1=(M11,LENGTH=9))
OUTFIL IFTHEN=(WHEN=(5,3,CH,EQ,C'S01'),BUILD=(1,15)),
       IFTHEN=(WHEN=(5,3,CH,NE,C'S01'),BUILD=(1,330))


But it seems the OUTFIL IFTHEN are ignored

Note that I want the detail sortout recsize to be 330 long, not 346
(header and trailer are 15 long, detail is 346 long)
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Mon Jan 19, 2009 10:42 pm
Reply with quote

OUTFIL IFTHEN is ignored because you have it in a second OUTFIL with the same ddname (default of SORTOUT). The second OUTFIL statement is ignored as indicated by the following message you would have received:

ICE219I 0 DUPLICATE DDNAME SORTOUT IGNORED

You need to use one OUTFIL statement with IFTHEN and TRAILER1. This should work:

Code:

  OPTION VLSHRT
  OMIT COND=(5,3,CH,EQ,C'S99')
  SUM  FIELDS=(53,10,63,10,73,10,83,10,93,10,103,10,113,10,123,10,
               133,10,143,10,153,10),FORMAT=PD
  SORT FIELDS=(18,12,BI,A,325,26,CH,A)
  OUTFIL REMOVECC,
     IFTHEN=(WHEN=(5,3,CH,NE,C'S01'),BUILD=(1,330)),
     TRAILER1=(C'S99',COUNT-1=(M11,LENGTH=9))
Back to top
View user's profile Send private message
Searchman

New User


Joined: 28 Dec 2006
Posts: 80
Location: France

PostPosted: Mon Jan 19, 2009 11:39 pm
Reply with quote

Exact, thank you

But, isn't possible to have 330 recsize after build, instead of 346
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Mon Jan 19, 2009 11:50 pm
Reply with quote

Are you asking how to get LRECL=330 for the output data set?

If so, you just need to specify LRECL=330 on the SORTOUT DD.

If that's not what you're asking, then please explain what you want clearly in more detail.
Back to top
View user's profile Send private message
Searchman

New User


Joined: 28 Dec 2006
Posts: 80
Location: France

PostPosted: Tue Jan 20, 2009 12:25 am
Reply with quote

Yes, I wonder, if I don't specify the LRECL in the SORTOUT DD, if DFSORT, with BUILD, could generate a 330 recsize (because in this case it takes the recsize of SORTIN and padds beyond 330)
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Tue Jan 20, 2009 12:50 am
Reply with quote

If you want DFSORT to set the LRECL to 330 automatically, you can use this OUTFIL statement:

Code:

  OUTFIL REMOVECC,   
   IFOUTLEN=330,                                 
   IFTHEN=(WHEN=(5,3,CH,NE,C'S01'),BUILD=(1,330)),     
   TRAILER1=(C'S99',COUNT-1=(M11,LENGTH=9))           


Without IFOUTLEN=330, DFSORT has to assume that an unchanged input record of 346 bytes could be output so it sets the LRECL to 346. With IFOUTLEN=330, DFSORT knows that the largest output record is 330 bytes, so it sets the LRECL to 330.
Back to top
View user's profile Send private message
Searchman

New User


Joined: 28 Dec 2006
Posts: 80
Location: France

PostPosted: Tue Jan 20, 2009 4:24 am
Reply with quote

Thank's again
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Return codes-Normal & Abnormal te... JCL & VSAM 7
No new posts How to append a PS file into multiple... JCL & VSAM 3
No new posts Insert header record with record coun... DFSORT/ICETOOL 14
No new posts convert file from VB to FB and use tr... DFSORT/ICETOOL 8
No new posts Insert trailer for non empty file only DFSORT/ICETOOL 6
Search our Forums:

Back to Top