MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Convert -ve in +ve

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
akhilraj2005
Beginner


Joined: 23 Mar 2005
Posts: 12
Topics: 3

PostPosted: Thu Apr 07, 2005 4:27 am    Post subject: Convert -ve in +ve Reply with quote

i have below card
902255

value at (1,2) will always have values GT values then (3,2) and (6,2).
i want to deduct difference of 22 and 55 from 90

90,sub,(20,sub,55) but actually its added beacuse
90,sub(-33) which equals to 123 but i want 90-33=57.

my outrec looks like-
Code:

(1,2,ZD,SUB,((3,2,ZD,MUL,7,1,ZD),SUB,(5,2,ZD,MUL,7,1,ZD)),EDIT=(TT),
                                                          *         
 LENGTH=2))                                                           

you can see error as *.

any solutions i have syncsort at my place.
Back to top
View user's profile Send private message
akhilraj2005
Beginner


Joined: 23 Mar 2005
Posts: 12
Topics: 3

PostPosted: Thu Apr 07, 2005 4:28 am    Post subject: Reply with quote

please ignore below quote

'value at (1,2) will always have values GT values then (3,2) and (6,2). '
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12376
Topics: 75
Location: San Jose

PostPosted: Thu Apr 07, 2005 5:37 am    Post subject: Reply with quote

Akhilraj,

If the difference between the 2nd and 3rd field results in a negative number, you can simply add that difference to the field at 1.

Try this

Code:

//SYSIN    DD *                                         
  SORT FIELDS=COPY                                       
  OUTREC FIELDS=(1,2,ZD,ADD,(3,2,ZD,SUB,5,2,ZD),EDIT=(TT))
/*                                                       


Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
akhilraj2005
Beginner


Joined: 23 Mar 2005
Posts: 12
Topics: 3

PostPosted: Thu Apr 07, 2005 7:46 am    Post subject: Reply with quote

sorry kolusu for not explaining it earlier..

this is not the only input data . there are several other data lines for whcih i need the same rule..

my input will be like this

503030 diff -> 50-(30-30) = 50 okay to me
503020 diff -> 50-(30-20) = 40 okay to me
502030 diff -> 50-(20-30) = 60 NOT okay to me i want 40 in this case also. So idea is not matter what type (+ to - value is returned by inner diff, discarding the sign i want to subtract it from 50.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12376
Topics: 75
Location: San Jose

PostPosted: Thu Apr 07, 2005 8:30 am    Post subject: Reply with quote

Akhilraj,

Try this . I assumed that your file has the following Attributes

LRECL=80 RECFM=FB

We first subtract field 2 from field 3 and put the result at the end of every record ignoring the sign using INREC fields.

Now using OUTREC fields we subtract the computed value from field1.

Code:

//STEP0100 EXEC PGM=SORT                           
//SYSOUT   DD SYSOUT=*                             
//SORTIN   DD *                                   
902255                                             
503030                                             
503020                                             
502030                                             
//SORTOUT  DD SYSOUT=*                             
//SYSIN    DD *                                   
  SORT FIELDS=COPY                                 
  INREC FIELDS=(1,80,(3,2,ZD,SUB,5,2,ZD),EDIT=(TT))
  OUTREC FIELDS=(1,2,ZD,SUB,81,2,ZD,EDIT=(TT))     
/*


Hope this helps...

Cheers

kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
akhilraj2005
Beginner


Joined: 23 Mar 2005
Posts: 12
Topics: 3

PostPosted: Thu Apr 07, 2005 10:43 am    Post subject: Reply with quote

Is it possible to perform this in single step. i am using INREC,OUTREC for some calculations. these values are used by final OUTFILE OUTREC stmt. Therefore I wish that in final stmt i get - converted to + .

my card is like this

INREC FIELDS=(some calculations)
OUTREC FIELDS=(calculations based on values calculated by INREC)
OUTFILE FNAME=OUT,OUTREC(convert - into + in the manner requested by me)
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12376
Topics: 75
Location: San Jose

PostPosted: Thu Apr 07, 2005 12:01 pm    Post subject: Reply with quote

Quote:

Is it possible to perform this in single step

akhilraj2005,

yes you can do that

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
akhilraj2005
Beginner


Joined: 23 Mar 2005
Posts: 12
Topics: 3

PostPosted: Thu Apr 07, 2005 11:19 pm    Post subject: Reply with quote

but how kolusu,

the syntax that i showed in my first post, is giveng me an error. Please post a solution.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12376
Topics: 75
Location: San Jose

PostPosted: Fri Apr 08, 2005 5:45 am    Post subject: Reply with quote

Quote:

but how kolusu,

the syntax that i showed in my first post, is giveng me an error. Please post a solution.


akhilraj,

How can I post a solution without knowing what calculations you are doing with INREC, OUTREC and OUTFIL OUTREC?

I cannot read your requirements over the internet. Please post a detailed information as what you are trying acomplish and we will try to help you.

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
akhilraj2005
Beginner


Joined: 23 Mar 2005
Posts: 12
Topics: 3

PostPosted: Fri Apr 08, 2005 6:55 am    Post subject: Reply with quote

It looks like converting the result of a subtraction from - to + in a single card is not possible. Shocked

my requirement is simple

(1,2,zd,sub,(3,4,zd,sub,5,6,zd))

now convert output of (3,4,zd,sub,5,6,zd) in + ve so that it can be subtracted by 1,2,zd (so that its not added because of - ve value).
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12376
Topics: 75
Location: San Jose

PostPosted: Fri Apr 08, 2005 7:31 am    Post subject: Reply with quote

Quote:

It looks like converting the result of a subtraction from - to + in a single card is not possible.


Akhilraj,

You are going in circles. Did you run the job shown by me 6 post above this post? huh? It does consider the negative value as positive values and subtracts it from field 1

Please read the post more clearly

Thanks

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group