View previous topic :: View next topic
|
Author |
Message |
lavudu
New User
Joined: 26 Feb 2008 Posts: 9 Location: Mumbai
|
|
|
|
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 |
|
|
Arunprasad.k
New User
Joined: 04 Jan 2008 Posts: 7 Location: Chennai, India
|
|
|
|
What is negate?? Want to overlay with SPACES??
Try using OVERLAY. |
|
Back to top |
|
|
Craq Giegerich
Senior Member
Joined: 19 May 2007 Posts: 1512 Location: Virginia, USA
|
|
|
|
Negate as in multiply by -1? |
|
Back to top |
|
|
lavudu
New User
Joined: 26 Feb 2008 Posts: 9 Location: Mumbai
|
|
|
|
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 |
|
|
lavudu
New User
Joined: 26 Feb 2008 Posts: 9 Location: Mumbai
|
|
|
|
Could U please send me the complete format for that.... |
|
Back to top |
|
|
Craq Giegerich
Senior Member
Joined: 19 May 2007 Posts: 1512 Location: Virginia, USA
|
|
|
|
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 |
|
|
lavudu
New User
Joined: 26 Feb 2008 Posts: 9 Location: Mumbai
|
|
|
|
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 |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
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 |
|
|
lavudu
New User
Joined: 26 Feb 2008 Posts: 9 Location: Mumbai
|
|
|
|
I am getting soc7 abend the input field is of type S9(09)V99 COMP-3. |
|
Back to top |
|
|
Craq Giegerich
Senior Member
Joined: 19 May 2007 Posts: 1512 Location: Virginia, USA
|
|
|
|
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 |
|
|
lavudu
New User
Joined: 26 Feb 2008 Posts: 9 Location: Mumbai
|
|
|
|
Yes It is...... |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
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 |
|
|
Craq Giegerich
Senior Member
Joined: 19 May 2007 Posts: 1512 Location: Virginia, USA
|
|
|
|
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 |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
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 |
|
|
lavudu
New User
Joined: 26 Feb 2008 Posts: 9 Location: Mumbai
|
|
|
|
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 |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
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 |
|
|
|