View previous topic :: :: View next topic

Author 
Message 
Sheshadri
New User
Joined: 09 Oct 2006 Posts: 12 Location: Chennai, India




Hello,
I need a sort card for this requirement.
I have input data as follows
Code: 
0.0001900891
0.0032409204
2.6755074E7
24.806694346
7.1290823E6
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 




murmohk1
Senior Member
Joined: 29 Jun 2006 Posts: 1439 Location: Bangalore,India




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 


Sheshadri
New User
Joined: 09 Oct 2006 Posts: 12 Location: Chennai, India




Hi Murali,
I need those with values > 9
The output file should contain the following
24.806694346
9.0006573669
Thanks! 

Back to top 


Frank Yaeger
DFSORT Moderator
Joined: 15 Feb 2005 Posts: 7130 Location: San Jose, CA




I assume that all numbers with negative exponents can be deleted since they can't be greater than 9  right? For example:
7.1290823E1
9.1290823E1
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 


Sheshadri
New User
Joined: 09 Oct 2006 Posts: 12 Location: Chennai, India




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 


Frank Yaeger
DFSORT Moderator
Joined: 15 Feb 2005 Posts: 7130 Location: San Jose, CA




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 E0?
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.6755074E7 > 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 


Sheshadri
New User
Joined: 09 Oct 2006 Posts: 12 Location: Chennai, India




Quote: 
Can you have E+0 and/or E0?

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.0012332E2  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 


Frank Yaeger
DFSORT Moderator
Joined: 15 Feb 2005 Posts: 7130 Location: San Jose, CA




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 


Sheshadri
New User
Joined: 09 Oct 2006 Posts: 12 Location: Chennai, India




Thanks a ton Frank! 

Back to top 



