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
 

 

Negate a pariticular field in input file using SORT fileds

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
lavudu

New User


Joined: 26 Feb 2008
Posts: 9
Location: Mumbai

PostPosted: Wed Mar 05, 2008 6:19 pm    Post subject: Negate a pariticular field in input file using SORT fileds
Reply with quote

Hi

How to negate a pariticular field in input file using sort fileds.
My input file is of record length 908
Output sorted file should have the same LRECL with the specific field negated.

That field is starting at position 169 of size 6 bytes.
Back to top
View user's profile Send private message

Arunprasad.k

New User


Joined: 04 Jan 2008
Posts: 7
Location: Chennai, India

PostPosted: Wed Mar 05, 2008 6:41 pm    Post subject:
Reply with quote

What is negate?? Want to overlay with SPACES??

Try using OVERLAY.
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Wed Mar 05, 2008 8:11 pm    Post subject:
Reply with quote

Negate as in multiply by -1?
Back to top
View user's profile Send private message
lavudu

New User


Joined: 26 Feb 2008
Posts: 9
Location: Mumbai

PostPosted: Wed Mar 05, 2008 8:42 pm    Post subject: Reply to: Sort fileds
Reply with quote

For example if the field has value 123456 then in the output file this particular field should be -123456.Remaining fields should remain the same.
Back to top
View user's profile Send private message
lavudu

New User


Joined: 26 Feb 2008
Posts: 9
Location: Mumbai

PostPosted: Wed Mar 05, 2008 8:44 pm    Post subject: Reply to: Negate a pariticular field in input file using SOR
Reply with quote

Could U please send me the complete format for that....
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Wed Mar 05, 2008 9:06 pm    Post subject: Re: Reply to: Negate a pariticular field in input file using
Reply with quote

lavudu wrote:
Could U please send me the complete format for that....


What format is that field in Packed Decimal, Zoned Decimal (with or without leading zeros), and what if that field already has 6 bytes in it?
Back to top
View user's profile Send private message
lavudu

New User


Joined: 26 Feb 2008
Posts: 9
Location: Mumbai

PostPosted: Wed Mar 05, 2008 10:40 pm    Post subject: Reply to: Negate a pariticular field in input file using SOR
Reply with quote

It is a Packed decimal and more over the output file should contain all the fileds including this negate filed. Input file is of LRECL(908) and please give me the complete format for OUTREC.
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: Wed Mar 05, 2008 11:01 pm    Post subject:
Reply with quote

Assuming that all of your input PD values are positive or you want to "negate" negative input values to positive output values, you can use a DFSORT job like the following to do what you asked for:

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input file (FB/908)
//SORTOUT DD DSN=...  output file (FB/908)
//SYSIN    DD    *
  OPTION COPY
  INREC OVERLAY=(169:169,6,PD,MUL,-1,TO=PD,LENGTH=6)
/*


If you have negative input values and you don't want to convert them to positive output values, then you need to say what you want to do with them.

If you're not familiar with DFSORT and DFSORT's ICETOOL, I'd suggest reading through "z/OS DFSORT: Getting Started". It's an excellent tutorial, with lots of examples, that will show you how to use DFSORT, DFSORT's ICETOOL and DFSORT Symbols. You can access it online, along with all of the other DFSORT books, from:

www.ibm.com/servers/storage/support/software/sort/mvs/srtmpub.html
Back to top
View user's profile Send private message
lavudu

New User


Joined: 26 Feb 2008
Posts: 9
Location: Mumbai

PostPosted: Thu Mar 06, 2008 4:01 pm    Post subject: Reply to: Negate a pariticular field in input file using SOR
Reply with quote

I am getting soc7 abend the input field is of type S9(09)V99 COMP-3.
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Thu Mar 06, 2008 6:31 pm    Post subject: Re: Reply to: Negate a pariticular field in input file using
Reply with quote

lavudu wrote:
I am getting soc7 abend the input field is of type S9(09)V99 COMP-3.


But is the data that is there really valid packed decimal?
Back to top
View user's profile Send private message
lavudu

New User


Joined: 26 Feb 2008
Posts: 9
Location: Mumbai

PostPosted: Thu Mar 06, 2008 6:40 pm    Post subject: Reply to: Negate a pariticular field in input file using SOR
Reply with quote

Yes It is......
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 Mar 06, 2008 10:27 pm    Post subject:
Reply with quote

That doesn't make sense. If the 6-byte PD values at 169-174 were valid, you wouldn't get the S0C7. Run this DFSORT/ICETOOL job to check the validity of the values:

Code:

//S1    EXEC  PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG  DD SYSOUT=*
//IN DD DSN=...  input file (FB/908)
//TOOLIN DD *
VERIFY FROM(IN) ON(169,6,PD)
/*


If you have invalid values, you'll get messages like this in TOOLMSG:

Code:

ICE618A 0 INVALID (169,6,PD)     VALUE - RECORD:  000000000000002
ICE649A 0   HEX VALUE:  12A34565821C                             
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Thu Mar 06, 2008 11:13 pm    Post subject:
Reply with quote

1. You are saying that field starts in 169 and is 6 bytes long, which for a PD field that would be 11 digits. Or does in start in 169 and is 4 bytes long which would allow 6 or 7 digits in PD format?

2. Is you file defined as VB and if it is did you take the 4 byte record length in to account?
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 Mar 06, 2008 11:46 pm    Post subject:
Reply with quote

Quote:
type S9(09)V99 COMP-3


1. That would be 11 digits which would correspond to a 6-byte PD field so unless he has the COBOL definition wrong, that would match what he said.

2. I assumed the file is FB, but he didn't really say, so it could be VB - and if he's not counting the RDW, then that would, of course, explain the 0C7. In that case, the INREC statement would be:

Code:

  INREC OVERLAY=(173:173,6,PD,MUL,-1,TO=PD,LENGTH=6)
Back to top
View user's profile Send private message
lavudu

New User


Joined: 26 Feb 2008
Posts: 9
Location: Mumbai

PostPosted: Fri Mar 07, 2008 9:49 am    Post subject: Reply to: Negate a pariticular field in input file using SOR
Reply with quote

I got the solution from my module head

Here it is

SORT FIELDS=COPY
OUTREC
BUILD=(1,168,169:(169,6,PD,MUL,-1),TO=PD,LENGTH=6))

Thanks a lot for all

lavudu
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 Mar 07, 2008 10:05 pm    Post subject:
Reply with quote

With DFSORT, the INREC OVERLAY statement I gave you does EXACTLY what that OUTREC BUILD statement does, only with less coding. If you don't get an S0C7 with that OUTREC BUILD then you won't get an S0C7 with the INREC OVERLAY.
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 How to change 'K' or 'M' use Sort vice_versa DFSORT/ICETOOL 5 Thu May 18, 2017 7:11 am
No new posts Converting Variable block file to Fix... bhavana yalavarthi DFSORT/ICETOOL 10 Tue May 16, 2017 2:20 pm
No new posts Replace values in the input data Vikas Maharnawar DFSORT/ICETOOL 10 Thu May 11, 2017 2:18 pm
No new posts Adding big TEXT lines to each record ... bshkris SYNCSORT 4 Sat May 06, 2017 1:40 am
No new posts Getting error while opening a variabl... apandey1 COBOL Programming 5 Fri May 05, 2017 12:22 pm


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