Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Icetool sort for proper trailer totals

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
AnujaS

New User


Joined: 23 Oct 2008
Posts: 5
Location: India

PostPosted: Fri Nov 07, 2008 10:03 am    Post subject: Icetool sort for proper trailer totals
Reply with quote

Hi,
I have a flat file, which has a header, Some 'P' records, some 'S' records and a trailer.
In o/p i wish to omit the 'S' records
O/p file should have header. 'P' records and trailer.
Trailer should have the total count of available 'P' records (count should exclude header and trailer).
Back to top
View user's profile Send private message

Arun Raj

Moderator


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

PostPosted: Fri Nov 07, 2008 10:27 am    Post subject:
Reply with quote

Hello,

Post a few sample input and output records using the "Code" button. Also what about the LRECL/RECFM of input/output files..?
Back to top
View user's profile Send private message
AnujaS

New User


Joined: 23 Oct 2008
Posts: 5
Location: India

PostPosted: Fri Nov 07, 2008 10:52 am    Post subject: Reply to: Icetool sort for proper trailer totals
Reply with quote

Code:

*Header(has branch no as zero)
0
*records
*branch| accountno| hier_ind| cutoff
1234       11111        P            20081212
1234       11111        S            20081203
1234       11111        S            20081204
*Trailer(has branch no as 9999999)
9999999  3

o/p required is
0
1234       11111        P            20081212
9999999  1(1 is the total number of 'P' records,how to get this 1)

------------------------


besides:
lrecl = 1000
recfm=fb for both i/p and o/p files
Back to top
View user's profile Send private message
Arun Raj

Moderator


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

PostPosted: Fri Nov 07, 2008 11:29 am    Post subject:
Reply with quote

You need to provide the position,length and type of relevant fields like branch and hier_ind
eg; branch no ----1-7 (ZD)
Back to top
View user's profile Send private message
sunnychopra

New User


Joined: 11 Mar 2008
Posts: 3
Location: Pune

PostPosted: Fri Nov 07, 2008 11:33 am    Post subject:
Reply with quote

Use this icon_smile.gif
Code:

//S1    EXEC  PGM=SORT                                     
//SORTIN DD *                                             
0                                                         
1234       11111        P            20081212             
1234       11111        S            20081203             
1234       11111        S            20081204             
9999999  3                                                 
/*                                                         
//SORTOUT   DD  SYSOUT=*                                   
//SYSOUT    DD  SYSOUT=*                                   
//SYSPRINT DD SYSOUT=*                                     
//SYSIN    DD  *                                           
  OPTION COPY                                             
  OMIT COND=(25,1,CH,EQ,C'S',OR,1,7,CH,EQ,C'9999999')     
  OUTFIL FNAMES=SORTOUT,TRAILER1=(1:'9999999',             
  COUNT-1=(EDIT=(IIT)))                                   
/*
Back to top
View user's profile Send private message
AnujaS

New User


Joined: 23 Oct 2008
Posts: 5
Location: India

PostPosted: Fri Nov 07, 2008 11:58 am    Post subject: Reply to: Icetool sort for proper trailer totals
Reply with quote

Code:

OPTION COPY                                                   
SORT FIELDS=(01,04,PD,A,                 * BRANCH-NO           
             08,05,PD,A,                 * ACCOUNT-NO         
             474,05,PD,A)                * LAST-CUTOFF-DATE   
OUTFIL FNAMES=ONLYPRIM,NODETAIL,                               
       OMIT=(684,1,CH,EQ,C'S'),                               
       OUTREC IF THEN=(WHEN=(01,04,PD,EQ,'9999999'),           
       OVERLAY=(1,27,28,8,COUNT=(M11,LENGTH=8),36,964))       
                                                               
OUTFIL FNAMES = ONLYSEC,NODETAIL,                             
       STARTREC = 2                                           
       OMIT = (684,1,CH,EQ,'P'),                               
       OUTREC IF THEN = (WHEN = (01,04,PD,EQ,'9999999'),       
       OVERLAY = (1,27,28,8,COUNT=(M11,LENGTH=8),36:964,PD'0'))




i am trying to use this, hope this clarifies
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Fri Nov 07, 2008 12:03 pm    Post subject:
Reply with quote

Hello,

Quote:
i am trying to use this, hope this clarifies
What happens when you run this?

Your "code" specifies packed-decimal data, but the sample data does not contain packed fields. . .

You need to post the messages (including message ids) that were produced by this execution.
Back to top
View user's profile Send private message
Arun Raj

Moderator


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

PostPosted: Fri Nov 07, 2008 12:08 pm    Post subject:
Reply with quote

Hello,
Quote:
hope this clarifies

No, seeing this I got more qns. Here you've 2 output files which is not mentioned in your original post.
Are you trying to split the input file into two files - one each for "P" and "S" records? If yes, how the header/trailer records should like? Should it be the same for both the output files except for the count? You need to do a better job of explaining what exactly you want to achieve.
Back to top
View user's profile Send private message
AnujaS

New User


Joined: 23 Oct 2008
Posts: 5
Location: India

PostPosted: Fri Nov 07, 2008 12:29 pm    Post subject: Reply to: Icetool sort for proper trailer totals
Reply with quote

Apologies,

--Header contains branch number as zeroes (helps to identify header)
--Each record contains several details and an indicator at the 684th position 'P' or 'S', indicating primary or secondary record
--Trailer contains several details, but branch number for trailer will be 9999999, and it will have a total of the number of records ('P' or 'S') at position 28, length 8

Requirement:
file 1 should contain header (branch number 0)
records with ind 'P'
Trailer should contain all the details as they were in i/p file except for position 28, which will contain count of all 'P' records

file 2
should not contain header
records with ind 'S'
trailer should have all details as it was in i/p file except at loaction 28, that has count of all 'S' records.
-----------------------------------------------
Back to top
View user's profile Send private message
sunnychopra

New User


Joined: 11 Mar 2008
Posts: 3
Location: Pune

PostPosted: Fri Nov 07, 2008 2:39 pm    Post subject:
Reply with quote

Am assuming trailer count at 8th pos and inidcator at 25th position.(As in exampole given by poster)

Code:

//S1    EXEC  PGM=SORT                                               
//SORTIN DD *                                                       
0                                                                   
1234       11111        P            20081212                       
1234       11111        S            20081203                       
1234       11111        S            20081204                       
9999999  3                                                           
/*                                                                   
//OUT1   DD  SYSOUT=*                                               
//OUT2   DD  SYSOUT=*                                               
//SYSOUT    DD  SYSOUT=*                                             
//SYSPRINT DD SYSOUT=*                                               
//SYSIN    DD  *                                                     
  OPTION COPY                                                       
  OUTFIL FNAMES=OUT1,OMIT=(25,1,CH,EQ,C'S',OR,1,7,CH,EQ,C'9999999'),
  TRAILER1=(1:'9999999',COUNT-1=(EDIT=(IIIIIIIT)))                   
  OUTFIL FNAMES=OUT2,INCLUDE=(25,1,CH,EQ,C'S'),                     
  TRAILER1=(1:'9999999',COUNT=(EDIT=(IIIIIIIT)))
/*                                               
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


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

PostPosted: Fri Nov 07, 2008 10:58 pm    Post subject:
Reply with quote

AnujaS,

sunnychopra's "solution" will NOT preserve the information in the trailer record as you requested because it just rebuilds certain fields in the trailer record. It also does NOT use the positions you specified for the fields.

Here's a DFSORT/ICETOOL job that will actually do what you asked for based on what you've said in your posts:

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input file (FB/1000)
//ONLYPRIM DD DSN=...  output file1 (FB/1000)
//ONLYSEC  DD DSN=...  output file2 (FB/1000)
//SYSIN    DD    *
  SORT FIELDS=(01,04,PD,A,                 * BRANCH-NO
               08,05,PD,A,                 * ACCOUNT-NO
               474,05,PD,A)                * LAST-CUTOFF-DATE
  OUTFIL FNAMES=ONLYPRIM,REMOVECC,
    OMIT=(684,1,CH,EQ,C'S'),
    IFOUTLEN=1000,
    IFTHEN=(WHEN=INIT,OVERLAY=(1001:SEQNUM,8,ZD)),
    IFTHEN=(WHEN=(1,4,PD,EQ,9999999),
      OVERLAY=(28:1001,8,ZD,SUB,+2,M11,LENGTH=8))
  OUTFIL FNAMES=ONLYSEC,REMOVECC,
    INCLUDE=(1,4,PD,EQ,9999999,OR,684,1,CH,EQ,C'S'),
    IFOUTLEN=1000,
    IFTHEN=(WHEN=INIT,OVERLAY=(1001:SEQNUM,8,ZD)),
    IFTHEN=(WHEN=(1,4,PD,EQ,9999999),
      OVERLAY=(28:1001,8,ZD,SUB,+1,M11,LENGTH=8))
/*
Back to top
View user's profile Send private message
AnujaS

New User


Joined: 23 Oct 2008
Posts: 5
Location: India

PostPosted: Wed Nov 12, 2008 8:37 am    Post subject: Reply to: Icetool sort for proper trailer totals
Reply with quote

Thanks Everybody,
This has worked well.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts SORT to unpack a feild shr_amar DFSORT/ICETOOL 7 Fri Jul 07, 2017 4:32 am
No new posts How to write Specific Fields from Mul... Padhu SYNCSORT 6 Thu Jul 06, 2017 10:26 am
No new posts Optimize sort inrec parse vishwakotin DFSORT/ICETOOL 6 Mon Jun 26, 2017 11:15 pm
No new posts Reduce CPU Times for Join Sort santoshn SYNCSORT 12 Sat Jun 10, 2017 1:40 pm
No new posts Db2 load job abending in SORT mistah kurtz DB2 4 Mon Jun 05, 2017 3:58 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us