IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Negate a pariticular field in input file using SORT fileds


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
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
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
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
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
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
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
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
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 Developer


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

PostPosted: Wed Mar 05, 2008 11:01 pm
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:

Use [URL] BBCode for External Links
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
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
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
Reply with quote

Yes It is......
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


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

PostPosted: Thu Mar 06, 2008 10:27 pm
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
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 Developer


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

PostPosted: Thu Mar 06, 2008 11:46 pm
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
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 Developer


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

PostPosted: Fri Mar 07, 2008 10:05 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts TRIM everything from input, output co... DFSORT/ICETOOL 1
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
Search our Forums:

Back to Top