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

Doubt in SECTIONS of DFSORT.


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

Active User


Joined: 10 May 2007
Posts: 147
Location: India

PostPosted: Wed Sep 24, 2008 10:19 pm
Reply with quote

Hi,

My input file is as below (FB 25)

Nr_ID;Date_ID;transaction_count
---------------------------
01010007902;20080922;0001
01010007902;20080922;0001
01010007902;20080922;0001
01010007903;20080922;0001
01010007903;20080922;0002
01010007903;20080922;0001
01010007903;20080922;0001

i want to calculate which Nr_ID has done maximum no of transactions(transaction_count) per day(Date_ID). In that case, the output (of FB 25)as below.

01010007903;20080922;0005

I have tried the below JCL.
Quote:

//S010 EXEC PGM=ICETOOL,COND=(0,LT),PARM='DYNALLOC=(3390,50)'
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//TOOLOUT DD SYSOUT=*
//EIN1 DD DSN=my.inputfile.fb25,
// DISP=SHR
//AUS1 DD DSN=EORGA.A4XZLF1.SHKJ.FORMAT.TEMP41,
// DISP=(NEW,CATLG,DELETE),
// DATACLAS=DCCOMP,
// DCB=(RECFM=FB,LRECL=25,BLKSIZE=0),
// SPACE=(CYL,(2,4),RLSE),
// UNIT=(3390,6)
//AUS2 DD DSN=EORGA.A4XZLF1.SHKJ.FORMAT.TEMP42,
// DISP=(NEW,CATLG,DELETE),
// DATACLAS=DCCOMP,
// DCB=(RECFM=FB,LRECL=25,BLKSIZE=0),
// SPACE=(CYL,(2,4),RLSE),
// UNIT=(3390,6)
//TOOLIN DD *
SORT FROM(EIN1) USING(CTL1)
SORT FROM(AUS1) USING(CTL2)
/*
//CTL1CNTL DD *
SORT FIELDS=(1,11,CH,A,13,08,CH,A)
OUTFIL FNAMES=AUS1,REMOVECC,NODETAIL,
SECTIONS=(1,20,
TRAILER3=(1,21,TOT=(22,04,UFF)))
/*
//CTL2CNTL DD *
SORT FIELDS=(13,08,CH,A)
OUTFIL FNAMES=AUS2,REMOVECC,NODETAIL,
SECTIONS=(13,08,
TRAILER3=(1,21,MAX=(22,16,UFF)))
/*
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*



But i got the error as below.

ICE201I E RECORD TYPE IS F - DATA STARTS IN POSITION 1
ICE230A 0 37 BYTE HEADER/TRAILER RECORD EXCEEDS 25 BYTE LRECL FOR AUS1
ICE751I 0 C5-K90007 C6-K90007 C7-K90000 C8-K90007 E4-K90007 E7-K11698
ICE052I 3 END OF DFSORT

Then in both CTL1 and CTL2, i made changes like this and increased teh output LRECL to 37 (DDNAME:AUS1) and 38(DDname: AUS2).


//CTL1CNTL DD *
SORT FIELDS=(1,11,CH,A,13,08,CH,A)
INREC FIELDS=(1,25,12X)
OUTFIL FNAMES=AUS1,REMOVECC,NODETAIL,
SECTIONS=(1,20,
TRAILER3=(1,21,TOT=(22,04,UFF)))
/*
//CTL2CNTL DD *
SORT FIELDS=(13,08,CH,A)
INREC FIELDS=(1,37,X)
OUTFIL FNAMES=AUS2,REMOVECC,NODETAIL,
SECTIONS=(13,08,
TRAILER3=(1,21,MAX=(22,16,UFF)))
/*

My queries are
(i) I am sure that the sum up values in CTL1 card won't exceed 4 digits. Can't i produce the output file with LRECL = 25 itself?

(ii) When i changed the CTL1 to have LRECL of 37 bytes for AUS1, DFSORT throws error saying that
"ICE230A 0 38 BYTE HEADER/TRAILER RECORD EXCEEDS 37 BYTE LRECL FOR AUS2"? how can i find the exact LRECL for the output file without trial and error method
Back to top
View user's profile Send private message
senjay

Active User


Joined: 10 May 2007
Posts: 147
Location: India

PostPosted: Wed Sep 24, 2008 10:24 pm
Reply with quote

Also, could you suggest me, is there any other better approach than this?
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Wed Sep 24, 2008 10:44 pm
Reply with quote

senjay,

You can just use the following DFSORT job to get the desired results

Code:

//STEP0100 EXEC PGM=ICEMAN   
//SYSOUT   DD SYSOUT=*       
//SORTIN   DD DSN=YOUR INPUT FB 25 FILE,DISP=SHR
//SORTOUT  DD SYSOUT=*               
//SYSIN    DD *                                 
  SORT FIELDS=(1,20,CH,A)                       
  OUTREC OVERLAY=(26:SEQNUM,8,ZD,RESTART=(1,20))
  OUTFIL REMOVECC,NODETAIL,BUILD=(80X),         
  TRAILER1=(1,21,MAX=(26,8,ZD,M11,LENGTH=4))   
/*
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: Wed Sep 24, 2008 11:42 pm
Reply with quote

Quote:
(i) I am sure that the sum up values in CTL1 card won't exceed 4 digits. Can't i produce the output file with LRECL = 25 itself?


Yes. Your problem is that you have:

TOT=(22,04,UFF)

This tells DFSORT to use the default for the total field which is 15 bytes long with an edit mask of M0. To get what you want, you just would need to use this:

TOT=(22,04,UFF,M11,LENGTH=4)

This will use 4 bytes for the total field.
Back to top
View user's profile Send private message
senjay

Active User


Joined: 10 May 2007
Posts: 147
Location: India

PostPosted: Thu Sep 25, 2008 10:11 am
Reply with quote

Hi,

Thanks Frank and Kolusu for your help.

Frank wrote:
Quote:

TOT=(22,04,UFF,M11,LENGTH=4)


Thanks frank, though you could have told me to look in to the manual properly.

Kolusu,

Your solution didn't work for my requirement. I think your solution will just tell me which Nr_ID + Date_Id combination occurs most.

In my first CTL1, i am summing up all the 'transaction_count' for a 'Nr_ID' done on a same day. then in the CTL2, i am finding out on a day 'date_ID', which 'NR_ID' has done the maximum 'transaction_count'.

Hope i defined the requirement more clearly this time.
Back to top
View user's profile Send private message
senjay

Active User


Joined: 10 May 2007
Posts: 147
Location: India

PostPosted: Thu Sep 25, 2008 7:47 pm
Reply with quote

Hi,

Now i have one more problem. my CTL2 is not giving me the expected output.

sample input for CTL2:
01010007902;20080915;0005
01010207908;20080915;0002
01010300901;20080915;0001
01012026603;20080915;0001
01012026603;20080912;0003
01012026603;20080912;0001
01012026603;20080911;0001
01012026603;20080911;0004


o/p i am getting:
01012026603;20080911;0004
01012026603;20080912;0003
01012026603;20080915;0005

Expected output:
01010007902;20080915;0005
01012026603;20080912;0003
01012026603;20080911;0004

Modified CTL2:

Code:

  SORT FIELDS=(13,08,CH,A)                               
  OUTFIL FNAMES=SORTOUT,REMOVECC,NODETAIL,             
    SECTIONS=(13,08,                                   
      TRAILER3=(1,21,MAX=(22,04,ZD,M11,LENGTH=4))) 


Could anyone help me in getting the expected output?
Back to top
View user's profile Send private message
senjay

Active User


Joined: 10 May 2007
Posts: 147
Location: India

PostPosted: Thu Sep 25, 2008 8:11 pm
Reply with quote

Hi,

Done with the ICETOOL.

Used teh below control cards.

Code:

//TOOLIN   DD *                                         
  SELECT FROM(EIN1) TO(AUS1) ON(13,08,CH) FIRST -       
  USING(CTL1)                                           
/*                                                     
//CTL1CNTL DD *                                         
   SORT FIELDS=(13,08,CH,A,22,4,CH,D)                   
/*     


I took a break and able to find out the solution. icon_redface.gif
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: Thu Sep 25, 2008 9:54 pm
Reply with quote

Quote:
Thanks frank, though you could have told me to look in to the manual properly.


Oh, sorry for being too helpful. icon_rolleyes.gif
Back to top
View user's profile Send private message
senjay

Active User


Joined: 10 May 2007
Posts: 147
Location: India

PostPosted: Fri Sep 26, 2008 8:33 am
Reply with quote

Me and my big mouth icon_smile.gif
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 Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts Calling DFSORT from Cobol, using OUTF... DFSORT/ICETOOL 5
No new posts DFsort help with SUM() DFSORT/ICETOOL 12
No new posts getting subtotals for multiple sections SYNCSORT 4
Search our Forums:

Back to Top