Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref

Author Message

New User

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

Posted: Thu Nov 29, 2007 12:34 pm    Post subject: Select numbers with Exponent and decimals.

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?

Thanks!

murmohk1

Senior Member

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

Posted: Thu Nov 29, 2007 12:39 pm    Post subject:

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.

New User

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

 Posted: Thu Nov 29, 2007 1:33 pm    Post subject: Reply to: Select numbers with Exponent and decimals. Hi Murali, I need those with values > 9 The output file should contain the following 24.806694346 9.0006573669 Thanks!
Frank Yaeger

DFSORT Moderator

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

 Posted: Thu Nov 29, 2007 9:46 pm    Post subject: 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

New User

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

Posted: Fri Nov 30, 2007 10:29 am    Post subject: Reply to: Select numbers with Exponent and decimals.

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!
Frank Yaeger

DFSORT Moderator

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

 Posted: Fri Nov 30, 2007 9:50 pm    Post subject: 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.

New User

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

Posted: Tue Dec 04, 2007 11:52 am    Post subject: Reply to: Select numbers with Exponent and decimals.

 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!
Frank Yaeger

DFSORT Moderator

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

Posted: Tue Dec 04, 2007 11:09 pm    Post subject:

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) /*

New User

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

 Posted: Fri Dec 07, 2007 2:39 pm    Post subject: Reply to: Select numbers with Exponent and decimals. Thanks a ton Frank!
 All times are GMT + 6 Hours
 Page 1 of 1

Search our Forum:

 Topic Author Forum Replies Posted Similar Topics How to select record x+7 or x+2 based... JoAnn Kulcyk SYNCSORT 6 Tue Jan 16, 2018 10:49 pm Can we limit length in concatenation ... balaji81_k DB2 7 Tue Aug 22, 2017 2:50 am Select numeric portion from CHAR data... balaji81_k DB2 6 Sat Aug 19, 2017 1:51 am SQL - select data available in index Nileshkul DB2 3 Mon Jun 26, 2017 1:30 am Incorrect output when trying to add n... monica1 PL/I & Assembler 10 Fri Jan 13, 2017 5:02 pm

 © 2003-2017 IBM MAINFRAME Software Support Division
 Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us