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
 

 

Select numbers with Exponent and decimals.

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Select numbers with Exponent and decimals.
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: 1439
Location: Bangalore,India

PostPosted: Thu Nov 29, 2007 12:39 pm    Post subject:
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    Post subject: Reply to: Select numbers with Exponent and decimals.
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 Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Thu Nov 29, 2007 9:46 pm    Post subject:
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    Post subject: Reply to: Select numbers with Exponent and decimals.
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 Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Fri Nov 30, 2007 9:50 pm    Post subject:
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    Post subject: Reply to: Select numbers with Exponent and decimals.
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 Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Tue Dec 04, 2007 11:09 pm    Post subject:
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    Post subject: Reply to: Select numbers with Exponent and decimals.
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    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 SQL - select data available in index Nileshkul DB2 3 Mon Jun 26, 2017 1:30 am
No new posts Incorrect output when trying to add n... monica1 PL/I & Assembler 10 Fri Jan 13, 2017 5:02 pm
No new posts Two Selects in a single select query Rohit Umarjikar DB2 1 Fri Nov 04, 2016 8:46 pm
No new posts Row-Numbers of distinct rows? Auryn DB2 1 Thu Oct 20, 2016 4:38 pm
No new posts Select first 2 group data vice_versa DFSORT/ICETOOL 10 Mon Jun 13, 2016 2:21 pm


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