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
 

 

sorting an input file

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

New User


Joined: 27 Jul 2007
Posts: 33
Location: mumbai

PostPosted: Thu Jun 03, 2010 3:27 pm    Post subject: sorting an input file
Reply with quote

Hi,

I want to sort an input file as given below:

Input
Emp Date sal
01 01022010 2
01 01022010 2
01 05022010 3
01 08092011 1
01 01062010 0
02 05022010 8
02 08092011 2
02 01062010 3

Output
Emp Date sal
01 01022010(min date) 8
02 05022010(min date) 13

In the above input the date field should be the minimum date for emp 01 and salary should be the summation of all the records of emp 01 or 02 respectively

Please do help me in achieving the output file as showm above.
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: Thu Jun 03, 2010 10:06 pm    Post subject:
Reply with quote

The min date for 02 would be 01062010, not 05022010.

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

Code:

//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
01    01022010 2
01    01022010 2
01    05022010 3
01    08092011 1
01    01062010 0
02    05022010 8
02    08092011 2
02    01062010 3
/*
//SORTOUT DD SYSOUT=*
//SYSIN DD *
  INREC OVERLAY=(81:11,4,7,4)
  SORT FIELDS=(1,2,CH,A,81,8,ZD,D)
  OUTFIL REMOVECC,NODETAIL,
    BUILD=(1,80),
    SECTIONS=(1,2,
      TRAILER3=(1,14,15:TOT=(16,1,ZD,EDIT=(IIIIT))))
/*
Back to top
View user's profile Send private message
vaibhavjadhav

New User


Joined: 27 Jul 2007
Posts: 33
Location: mumbai

PostPosted: Mon Jul 05, 2010 5:39 pm    Post subject: Reply to: sorting an input file
Reply with quote

Hi Frank Thanks for giving me the solution. Actually i tried doing the same with some more fields but didnt got the output. Will it be possible for you to ellaborate what exactly the fields are doing. Also i am a attaching the new input and output file, can you give output for this even. Thanks in advance.




Branch Agent Enddt Inpdt Amount
Input
122 2245 3041201 3041221 -3.75
122 2245 3051201 3051220 -3.75
122 2245 3061201 3061219 -3.75
122 2245 3071201 3071227 -3.75
122 2245 3041201 3041221 -3.00
251 1036 3070115 3070115 -200.00
251 1036 3070111 3070111 -200.00

Output
122 2245 3041201 3041221 -18.00
251 1036 3070111 3070111 -400.00
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: Tue Jul 06, 2010 2:51 am    Post subject:
Reply with quote

vaibhavjadhav,

What are the "rules" for getting from input to output for your new requirement? What is the starting position and length for each field?
Back to top
View user's profile Send private message
vaibhavjadhav

New User


Joined: 27 Jul 2007
Posts: 33
Location: mumbai

PostPosted: Tue Jul 06, 2010 9:44 am    Post subject: Reply to: sorting an input file
Reply with quote

Hi Frank,

Apologize i didnt mention it clearly. Thanks for looking into my concern.

In the above input the date field should be the minimum date for all the Branch and agent and salary should be the summation of all the records of Branch 122 and 251 respectively. Please have a look at the below input and output structure.

Note: There should not be space between any two fields. Unfortunately if there seems to have any space could you tell me where exactly I have to change.

Please do help me with this issue. Do let me know if you have any concerns.

Input
Branch Agent Enddt Inpdt Amount
9(3) 9(4) 9(7) 9(7) S9(14)V9(4)
122 2245 3041201 3041221 -3.75
122 2245 3051201 3051220 -3.75
122 2245 3061201 3061219 -3.75
122 2245 3071201 3071227 -3.75
122 2245 3041201 3041221 -3.00
251 1036 3070115 3070115 -200.00
251 1036 3070111 3070111 -200.00

Output
Branch Agent Enddt Inpdt Amount
9(3) 9(4) 9(7) 9(7) S9(14)V9(4)
122 2245 3041201(min date) 3041221(min date) -18.00
251 1036 3070111(min date) 3070111(min date) -400.00
Back to top
View user's profile Send private message
anshul_gugnani

New User


Joined: 02 Nov 2009
Posts: 73
Location: Mumbai

PostPosted: Tue Jul 06, 2010 2:46 pm    Post subject:
Reply with quote

Hello Vaibhav,

Assuming the date is in format ddyyyy and input LRECL as 80, the following sort card can give you desired result -
Code:
INREC OVERLAY=(81:13,04,10,3,21,4,18,3,26,19,FS,PD,LENGTH=10)     
SORT FIELDS=(01,03,CH,A,81,7,ZD,D,88,7,ZD,D)                     
OUTFIL REMOVECC,NODETAIL,                                       
BUILD=(1,80),                                                   
SECTIONS=(01,03,                                                 
TRAILER3=(01,25,TOT=(95,10,PD,EDIT=(STTTTTTTTTTTTTTTTTTT.TT),SIGNS=(+,-))))


Hope this helps.
Anshul
Back to top
View user's profile Send private message
sqlcode1

Active Member


Joined: 08 Apr 2010
Posts: 578
Location: USA

PostPosted: Tue Jul 06, 2010 4:01 pm    Post subject:
Reply with quote

Hi

I asked this question earlier but my post got deleted...I am asking again.
In the date field what does '3' in front of date indicate?

Also

Quote:
In the above input the date field should be the minimum date for all the Branch and agent and salary should be the summation of all the records of Branch 122 and 251 respectively.


here you said you wanted minimum input date for branch and agent but then you said salary should be summation of all the records for branch 122 and 251????

What if there is one more agent code for 122 or 251?

Thanks,
Back to top
View user's profile Send private message
anshul_gugnani

New User


Joined: 02 Nov 2009
Posts: 73
Location: Mumbai

PostPosted: Tue Jul 06, 2010 4:18 pm    Post subject:
Reply with quote

Hi sqlcode1,

I am not sure but I think date is in format of dddyyyy as in (julian date and year)

This will get clear once ts replies. However, I have posted my solution on this assumption.

Thanks,
Anshul.
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10256
Location: italy

PostPosted: Tue Jul 06, 2010 7:07 pm    Post subject: Reply to: sorting an input file
Reply with quote

the date data for the second request is something completely different
Quote:
3041201(min date) 3041221(min date)

I wonder what date format they use ?
Back to top
View user's profile Send private message
anshul_gugnani

New User


Joined: 02 Nov 2009
Posts: 73
Location: Mumbai

PostPosted: Tue Jul 06, 2010 7:12 pm    Post subject:
Reply with quote

Quote:
the date data for the second request is something completely different
Quote:
3041201(min date) 3041221(min date)

I wonder what date format they use ?


I did not notice this, I assumed format is dddyyyy.
Now, Even I wonder what date format this could be. icon_rolleyes.gif
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 Sorting of hex values Saurabh_mi DFSORT/ICETOOL 11 Thu May 25, 2017 3:49 pm
No new posts Converting Variable block file to Fix... bhavana yalavarthi DFSORT/ICETOOL 10 Tue May 16, 2017 2:20 pm
No new posts Replace values in the input data Vikas Maharnawar DFSORT/ICETOOL 10 Thu May 11, 2017 2:18 pm
No new posts Getting error while opening a variabl... apandey1 COBOL Programming 5 Fri May 05, 2017 12:22 pm
No new posts Issue with NDM process to transmit ES... chetanambi All Other Mainframe Topics 6 Wed May 03, 2017 10:52 am


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