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
 

 

Divide a 2 place decmal field by 100 by using DFSORT/ICETOOL

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

New User


Joined: 24 Jul 2007
Posts: 55
Location: noida

PostPosted: Fri Mar 04, 2011 10:39 pm    Post subject: Divide a 2 place decmal field by 100 by using DFSORT/ICETOOL
Reply with quote

Hi All

I have a o/p file of 885 LRECL (VB format) having 2 alphanumeric fields of X(1) say 1 at position 591 and 2nd at position 798 and another 1 field of pic clause 9(5).9(2) at position 649-656.

Now the requirement is If in the file the field at 591 position holds value '8' and 798 pos holds value 'R' then the third field (at pos 649-656) value should be divided by 100.

Can this be done through DFSORT or ICETOOL. If yes could you please provide me the syntax for it. Please let me know if anything else is required.

Thanks in advance.

Regards
Puneet
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: Sat Mar 05, 2011 2:06 am    Post subject:
Reply with quote

Yes, but you have to do a better job of explaining what you want for output before I can show you how to do it.

Are these valid examples of the 9(5).9(2) values?

12345.12
98765.92

What output would you want when these are divided by 100?

00123.45
00987.65

or something else - what?

Do the positions you mentioned (e.g. 591) include the RDW in 1-4 of the VB record, or do we need to add 4 to them (e.g. 595)?
Back to top
View user's profile Send private message
puneetvirmani143

New User


Joined: 24 Jul 2007
Posts: 55
Location: noida

PostPosted: Mon Mar 07, 2011 7:57 pm    Post subject: Reply to: Divide a 2 place decmal field by 100 by using DFSO
Reply with quote

Hi Frank

Thanks for the reply. Below mentioned examples by you for 9(5).9(2) values are valid.

12345.12
98765.92


It would be great if I can get the syntax for the codes getting the below o/p value for field.

1. 00123.45 as mentioned by you.
2. 123.4512 which is the actual value getting after the divide by 100.

Please let me know if any thing else is required.

Regards
Puneet
Back to top
View user's profile Send private message
puneetvirmani143

New User


Joined: 24 Jul 2007
Posts: 55
Location: noida

PostPosted: Mon Mar 07, 2011 8:00 pm    Post subject: Reply to: Divide a 2 place decmal field by 100 by using DFSO
Reply with quote

Hi Frank

Missed to add 1 thing in above post that the 4 bytes would be added in the above mentioned field . For Eg. field at 591 position would be condidered at 595.
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 Mar 08, 2011 2:05 am    Post subject:
Reply with quote

Dividing by 100 is pretty easy. You really don't even have to divide ... you just need to manipulate the fields.

If you want the result to be 00123.45, you can use these DFSORT control statements:

Code:

  OPTION COPY                                               
  INREC IFTHEN=(WHEN=(595,1,CH,EQ,C'8',AND,802,1,CH,EQ,C'R'),
    OVERLAY=(653:653,5,UFF,EDIT=(00TTT.TT)))                 


If you want the result to be 123.4512, you can use these DFSORT control statements:

Code:

 OPTION COPY                                                 
 INREC IFTHEN=(WHEN=(595,1,CH,EQ,C'8',AND,802,1,CH,EQ,C'R'), 
   OVERLAY=(653:653,8,UFF,EDIT=(TTT.TTTT)))                   
Back to top
View user's profile Send private message
puneetvirmani143

New User


Joined: 24 Jul 2007
Posts: 55
Location: noida

PostPosted: Wed Mar 09, 2011 2:36 pm    Post subject: Reply to: Divide a 2 place decmal field by 100 by using DFSO
Reply with quote

Hi Frank

Thanks for the reply. There is a slight change in requirement. The field at 653 position should be divided by 100 but the o/p should be displayed in format 9(2).((5) . For example if the value in field is 00030.00, the o/p value should be 00.30000 and if the value is 01000.00 the value should be 10.00000.

Please let me know the syntax of control statement in this case.

Thanks in advance
Puneet
Back to top
View user's profile Send private message
daveporcelan

Active Member


Joined: 01 Dec 2006
Posts: 645
Location: Pennsylvania

PostPosted: Wed Mar 09, 2011 6:32 pm    Post subject:
Reply with quote

Puneet,

This is the PERFECT oppurtunity for you to use your skills and figure this out.

Frank gave you two examples of formatting output.

Surely you can use them and figure this out on your own.

But alas Frank will come to the rescue with the answer.

PS - My ten year old son can figure this one out.
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 Mar 09, 2011 11:22 pm    Post subject:
Reply with quote

Dave,

Please do have your 10 year old son respond with the answer. (I'd get one my pet rats to do it, but they're busy working on a new theory of relativity.) icon_lol.gif

Thanks.
Back to top
View user's profile Send private message
daveporcelan

Active Member


Joined: 01 Dec 2006
Posts: 645
Location: Pennsylvania

PostPosted: Wed Mar 09, 2011 11:25 pm    Post subject:
Reply with quote

He is still in school until 3:30 eastern time.

He also does not have DFSORT installed on his MAC.
icon_cool.gif
Puneet is on his own.
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 Mar 10, 2011 12:13 am    Post subject:
Reply with quote

A good opportunity for you to show him how to use the mainframe if you have access from home. icon_smile.gif
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 Mar 10, 2011 2:02 am    Post subject:
Reply with quote

Puneet,

Compliments of my pet rat Nora, who took a few minutes to figure it out during her lunch break. icon_biggrin.gif

Code:

  OPTION COPY                                                   
  INREC IFTHEN=(WHEN=(595,1,CH,EQ,C'8',AND,802,1,CH,EQ,C'R'),   
    OVERLAY=(653:654,7,UFF,EDIT=(TT.TTTT),C'0'))                 
Back to top
View user's profile Send private message
puneetvirmani143

New User


Joined: 24 Jul 2007
Posts: 55
Location: noida

PostPosted: Fri Mar 25, 2011 3:38 pm    Post subject: Reply to: Divide a 2 place decmal field by 100 by using DFSO
Reply with quote

Hi Frank/All

Thanks for all your support. The Sort card provided by you worked successfully.

1 more requirement is added to this. Now by using above SORT card, field at position 653 has been changed for records in o/p gdg version.

My requirement is to compare the particular field at pos 653 of both i/p and o/p gdg versions and report the records having differences in sysout or a pds.

Please suggest if it could be done using Sort. By using utility IEBCOMP the complete files can be compared but i am not sure how to compare particular column.It would be great help if you provide the syntax for it.
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 Mar 25, 2011 11:37 pm    Post subject:
Reply with quote

I suspect you could do what you want with JOINKEYS, but you haven't given enough information for me to know exactly what it is you want to do.

For more information on JOINKEYS, see:

http://www.ibm.com/support/docview.wss?rs=114&uid=isg3T7000174

If you need more specific help, show an example of the records in each input file (relevant fields only) and what you expect for output. Explain the "rules" for getting from input to output. Give the starting position, length and format of each relevant field. Give the RECFM and LRECL of the input files. If file1 can have duplicates within it, show that in your example. If file2 can have duplicates within it, show that in your example.

Also, run this job and show the //SYSOUT messages you receive, so I can see what level you're at:

Code:

//S1    EXEC  PGM=SORT
//SYSOUT    DD  SYSOUT=*
//SORTIN DD *
RECORD
//SORTOUT DD DUMMY
//SYSIN    DD    *
    OPTION COPY
/*
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 Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts How to get the remainder and quotient... vnktrrd DFSORT/ICETOOL 2 Mon Oct 31, 2016 10:59 am
No new posts How to split the records using the am... vnktrrd DFSORT/ICETOOL 24 Fri Oct 28, 2016 7:33 pm
No new posts Sort records based on numeric field. Alks SYNCSORT 2 Wed Oct 19, 2016 10:14 pm
No new posts How to delete second instance from Fl... Gunapala CN DFSORT/ICETOOL 6 Tue Oct 18, 2016 11:42 pm


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