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

Select numbers with Exponent and decimals.


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

New User


Joined: 09 Oct 2006
Posts: 12
Location: Chennai, India

PostPosted: Thu Nov 29, 2007 12:34 pm
Reply with quote

Hello,

I need a sort card for this requirement.

I have input data as follows

Code:

0.0001900891                       
0.0032409204                       
2.6755074E-7                       
24.806694346                       
7.1290823E-6                       
9.0006573669   


I need to pick up numbers greater than 9 and move it to output file.
Please note that few inputs are having E(exponential)and how to expand that?

Please advise.

Thanks!
Sheshadri
Back to top
View user's profile Send private message
murmohk1

Senior Member


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

PostPosted: Thu Nov 29, 2007 12:39 pm
Reply with quote

Shesha,

Quote:
I need to pick up numbers greater than 9 and move it to output file.

Greater than 9 in value or in length.

Post O/P for the above I/P.
Back to top
View user's profile Send private message
Sheshadri

New User


Joined: 09 Oct 2006
Posts: 12
Location: Chennai, India

PostPosted: Thu Nov 29, 2007 1:33 pm
Reply with quote

Hi Murali,

I need those with values > 9

The output file should contain the following

24.806694346
9.0006573669

Thanks!
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 Nov 29, 2007 9:46 pm
Reply with quote

I assume that all numbers with negative exponents can be deleted since they can't be greater than 9 - right? For example:

7.1290823E-1
9.1290823E-1

Can you have numbers with positive exponents (E+n)?

If so, can you have numbers with positive exponents and the first digit = 0 like this:

0.7129082E+1
0.9129082E+1
0.0712908E+2

or are the values with exponents always in a normalized form with the first digit > 0. For example:

7.1290823E+1
9.1290823E+1
Back to top
View user's profile Send private message
Sheshadri

New User


Joined: 09 Oct 2006
Posts: 12
Location: Chennai, India

PostPosted: Fri Nov 30, 2007 10:29 am
Reply with quote

Dear Frank,

Quote:

I assume that all numbers with negative exponents can be deleted since they can't be greater than 9 - right?


Yes, you are correct.

Quote:

Can you have numbers with positive exponents (E+n)


Yes.

Quote:

If so, can you have numbers with positive exponents and the first digit = 0

Yes. we can have zero and greater than zero here.

Thanks!
Sheshadri
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: Fri Nov 30, 2007 9:50 pm
Reply with quote

Hmmm... to come up with appropriate rules for doing this, I need to understand the full range of the values you can have.

Can you have E+0 and/or E-0?

Can you have E+nn where nn is two digits? More precisely, what is the maximum exponent you can have?

Is every value put into a form that has 12 characters? For example:

0.0001900891 -> you have 10 digits after the decimal point

24.806694346 -> you have 9 digts after the decimal point

2.6755074E-7 -> you have 7 digits after the decimal point

Which of the following would you want in the output data set?

0.9000000001
0.9000000000
0.9000001E+0
0.9000000E+0
0.0900001E+1
0.0900000E+1

Please give a better example of the possible input values with positive and negative exponents, and the expected output values.
Back to top
View user's profile Send private message
Sheshadri

New User


Joined: 09 Oct 2006
Posts: 12
Location: Chennai, India

PostPosted: Tue Dec 04, 2007 11:52 am
Reply with quote

Quote:

Can you have E+0 and/or E-0?

No.
Quote:

what is the maximum exponent you can have?

Max 1 exponent. Example: E+2, E+3 etc.
Quote:

Is every value put into a form that has 12 characters?

Yes. The length is 12 which is inclusive of the "." - decimal point, "E" exponent. Also, there can be only maximum 2 digits before the decimal point. Example: 1.2345678912 and 12.345678912

Quote:

Which of the following would you want in the output data set?

The output should contain the values greater than 9.
None of your example shall be in the output as they are all ".9"s.

Examples:

As discussed, we may ignore the values with negative exponents as they will certainly be lesser than 9. But these need to be calculated to ignore the ones which are lesser than 9.

1.3456789012 - this won't be there in the o/p
1.3456789E+2 - this should be there in the o/p
0.0091234E+4 - this should be there in the o/p
9.0012332E-2 - this should NOT be there in the o/p as it would be < 9
9.0010012341 - this should be there in the o/p

Thanks!
Sheshadri
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: Tue Dec 04, 2007 11:09 pm
Reply with quote

This is quite tricky, but I believe the following DFSORT job will do what you asked for. I assumed your input file has RECFM=FB and LRECL=20, but the job can be changed appropriately for other attributes.

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=... input file (FB/20)
//SORTOUT DD DSN=... output file (FB/20)
//SYSIN    DD    *
  OPTION COPY
  ALTSEQ CODE=(40F0)
  OMIT COND=(1,12,SS,EQ,C'-')
  INREC IFTHEN=(WHEN=INIT,
          PARSE=(%01=(ENDBEFR=C'.',FIXLEN=2),
                 %02=(ENDBEFR=C'E+',ENDBEFR=C' ',FIXLEN=10))),
        IFTHEN=(WHEN=INIT,
          PARSE=(%03=(STARTAFT=C'E+',FIXLEN=1)),
          OVERLAY=(21:%01,UFF,TO=ZD,LENGTH=2,
                   23:%02,TRAN=ALTSEQ,
                   33:%03,
                   34:C'1000000000')),
   IFTHEN=(WHEN=(33,1,CH,EQ,C'8'),OVERLAY=(43:X)),
   IFTHEN=(WHEN=(33,1,CH,EQ,C'7'),OVERLAY=(42:2X)),
   IFTHEN=(WHEN=(33,1,CH,EQ,C'6'),OVERLAY=(41:3X)),
   IFTHEN=(WHEN=(33,1,CH,EQ,C'5'),OVERLAY=(40:4X)),
   IFTHEN=(WHEN=(33,1,CH,EQ,C'4'),OVERLAY=(39:5X)),
   IFTHEN=(WHEN=(33,1,CH,EQ,C'3'),OVERLAY=(38:6X)),
   IFTHEN=(WHEN=(33,1,CH,EQ,C'2'),OVERLAY=(37:7X)),
   IFTHEN=(WHEN=(33,1,CH,EQ,C'1'),OVERLAY=(36:8X)),
   IFTHEN=(WHEN=(33,1,CH,EQ,C' '),OVERLAY=(35:9X))
  OUTREC BUILD=(1,20,21:21,12,ZD,MUL,34,10,UFF,TO=PD,LENGTH=16)
  OUTFIL INCLUDE=(21,16,PD,GT,+90000000000),BUILD=(1,20)
/*
Back to top
View user's profile Send private message
Sheshadri

New User


Joined: 09 Oct 2006
Posts: 12
Location: Chennai, India

PostPosted: Fri Dec 07, 2007 2:39 pm
Reply with quote

Thanks a ton Frank! 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 Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts Generate random number from range of ... COBOL Programming 3
No new posts Dynamically pass table name to a sele... DB2 2
No new posts SELECT from data change table DB2 5
No new posts Select two different counts from SQL... DB2 6
Search our Forums:

Back to Top