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
 

 

How to produce 3rd column by adding two columns using DFSORT

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

New User


Joined: 26 Jul 2007
Posts: 6
Location: chennai

PostPosted: Wed Dec 12, 2007 2:13 pm    Post subject: How to produce 3rd column by adding two columns using DFSORT
Reply with quote

Hi,

I have a file with two fields, To produce a report I need to add these two fields to produce a third field in my report. How to do this using DFSORT? icon_rolleyes.gif
Back to top
View user's profile Send private message

krisprems

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Wed Dec 12, 2007 3:41 pm    Post subject:
Reply with quote

sheiksulaiman
Check this sample DFSORT JOB and if this is not what you wanted then get back with some example i/p and o/p records..also file attributes
Code:
//*******************************************************
//STEP1    EXEC PGM=SORT                                 
//SYSOUT   DD SYSOUT=*                                   
//SORTIN   DD *                                         
123 456                                                 
----+----1----+----2----+----3----+----4----+----5----+--
121 111                                                 
/*                                                       
//SORTOUT  DD SYSOUT=*                                   
//SYSIN    DD *                                         
  OPTION NZDPRINT,COPY                                   
  OUTREC OVERLAY=(10:1,3,ZD,ADD,5,3,ZD,EDIT=(TTTT))   
/*                                                       


SORTOUT
Code:
123 456  0579 
121 111  0232 
Back to top
View user's profile Send private message
sheiksulaiman

New User


Joined: 26 Jul 2007
Posts: 6
Location: chennai

PostPosted: Wed Dec 12, 2007 6:34 pm    Post subject:
Reply with quote

Thank u very much ..
It is working.

One more clarification after doing this I want a toal like

field1 field2 field 3

100 200 300
200 50 250
900 50 950
------ ------ -------
1200 300 1500 icon_rolleyes.gif

I used like

TRAILER1=(/39:'-------------------',
63:'-------------------',
88:'-------------------',/,
/8:'TOTAL',
40:TOT=(82,5,PD,EDIT=(IIIIIIIIT)), **first field total
64:TOT=(87,5,PD,EDIT=(IIIIIIIIT))) **second field total

But, I don't know how to calculate the total of third field.

Can u please help me.


Thanks
Sheik
Back to top
View user's profile Send private message
krisprems

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Wed Dec 12, 2007 7:16 pm    Post subject:
Reply with quote

Code:
//*******************************************************
//STEP1    EXEC PGM=SORT                                 
//SYSOUT   DD SYSOUT=*                                   
//SORTIN   DD *                                           
123   456                                                 
----+----1----+----2----+----3----+----4----+----5----+---
121   111                                                 
/*                                                       
//SORTOUT  DD SYSOUT=*                                   
//SYSIN    DD *                                           
  OPTION COPY                                             
  OUTREC OVERLAY=(15:(1,3,ZD,ADD,7,3,ZD),EDIT=(TTTT))     
  OUTFIL REMOVECC,                                       
  TRAILER1=(/,1:C'----',6:C'----',15:C'-----',/,         
            1:TOT=(1,3,ZD,M10,LENGTH=4),                 
            6:TOT=(7,3,ZD,M10,LENGTH=4),                 
            15:TOT=(15,4,ZD,M10,LENGTH=5))               
/*                                                       


SORTOUT
Code:
123   456     0579   
121   111     0232   
                     
---- ----     -----   
 244  567       811   
Back to top
View user's profile Send private message
sheiksulaiman

New User


Joined: 26 Jul 2007
Posts: 6
Location: chennai

PostPosted: Wed Dec 12, 2007 8:17 pm    Post subject:
Reply with quote

This is my JCL,

Code:

//STEP1    EXEC PGM=SORT                                               
//SORTIN   DD   DSN=MAPP.TEST,DISP=SHR                                 
//FILE1    DD   SYSOUT=G,DCB=(BLKSIZE=1340,LRECL=134,RECFM=FBA)       
//SYSPRINT DD   SYSOUT=*                                               
//SYSOUT   DD   SYSOUT=G                                               
//SYSIN    DD   *                                                     
 SORT FIELDS=(1,35,CH,A)                                               
 OPTION COPY                                                           
 OUTFIL FNAMES=FILE1,                                                 
        LINES=41,                                                     
        OUTREC=(2:52,30,                                               
                40:82,5,PD,EDIT=(IIIIIIIIT),                           
                64:87,5,PD,EDIT=(IIIIIIIIT),                           
                91:(82,5,PD,ADD,87,5,PD),EDIT=(IIIIIIIIT),             
                133:C' '),                                             
        HEADER1=(2:'SE15/P42',                                         
                 88:36,10,/,/,                                         
                 30:REPORT ON COUNTS',/,
                 2:'     ',/,                                         
                 45:'COUNT1 ',                             
                 70:'COUNT2',                             
                 88:'TOTAL - COUNT ',/),                             
        TRAILER1=(/39:'-------------------',                           
                 63:'-------------------',                             
                 88:'----------------',/,                             
                 /8:'TOTAL',                                           
                  40:TOT=(82,5,PD,EDIT=(IIIIIIIIT)),                   
                  64:TOT=(87,5,PD,EDIT=(IIIIIIIIT)),                   
                  88:TOT=(here I want a total :roll: ))
/*


When tried like TOT=(91,5,PD,EDIT=(IIIIIIIIT)) , it is not working.Actually this takes data from input file.
Back to top
View user's profile Send private message
murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1439
Location: Bangalore,India

PostPosted: Wed Dec 12, 2007 8:22 pm    Post subject:
Reply with quote

SS,

Quote:
it is not working.Actually this takes data from input file.

Getting any err icon_sad.gif r?
Back to top
View user's profile Send private message
sheiksulaiman

New User


Joined: 26 Jul 2007
Posts: 6
Location: chennai

PostPosted: Wed Dec 12, 2007 8:51 pm    Post subject:
Reply with quote

in input file from column 92-134 has 0. The command
Tot=(92,5,PD,EDIT=(IIIIIIIIT)) takes 0 as input value.
Back to top
View user's profile Send private message
murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1439
Location: Bangalore,India

PostPosted: Wed Dec 12, 2007 8:58 pm    Post subject:
Reply with quote

ss,

Quote:
When tried like TOT=(91,5,PD,EDIT=(IIIIIIIIT))

Quote:
Tot=(92,5,PD,EDIT=(IIIIIIIIT)) takes 0 as input value.

typo error?
Back to top
View user's profile Send private message
krisprems

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Wed Dec 12, 2007 9:48 pm    Post subject:
Reply with quote

sheiksulaiman

If you are getting any error,then provide the SYSOUT details.
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: Wed Dec 12, 2007 11:21 pm    Post subject:
Reply with quote

ss,

I see several errors here.

Code:
 
                 30:REPORT ON COUNTS',/,


is missing a leading apostrophe. It should be:

Code:
 
                 30:'REPORT ON COUNTS',/,


Code:

                 88:TOT=(91,5,PD,EDIT=(IIIIIIIIT))   


is missing an ending paren. It should be:

Code:

                 88:TOT=(91,5,PD,EDIT=(IIIIIIIIT)))


Code:

                  64:TOT=(87,5,PD,EDIT=(IIIIIIIIT)), 
                  88:TOT=(91,5,PD,EDIT=(IIIIIIIIT))) 


If you have a 5-byte PD field in 87-91, it doesn't make sense for the next PD field to start in 91. That would mean that the last byte of one PD field overlaps the first byte of the next PD field. Check where your PD fields are actually located.

And saying "it is not working" without any details is NOT helpful. In what way is it NOT working? Did you get any error messages? If so, what are they?
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 Adding big TEXT lines to each record ... bshkris SYNCSORT 4 Sat May 06, 2017 1:40 am
No new posts unload data from table with lob columns farhad_evan DB2 0 Sat Apr 22, 2017 1:32 pm
No new posts DFSORT - Overriding default option TU... Steve Ironmonger DFSORT/ICETOOL 3 Tue Apr 04, 2017 3:54 pm
No new posts DFSORT MUL FIELDS tspr52 DFSORT/ICETOOL 16 Fri Mar 03, 2017 11:53 pm
No new posts Produce Mainframe Dash Board Reports ... sdcarlson53 All Other Mainframe Topics 2 Thu Jan 05, 2017 11:01 pm


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