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 

Transpose Negative Sign from Right to Left

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


Joined: 13 Dec 2002
Posts: 45
Topics: 3
Location: 3rd Block from the SUN

PostPosted: Thu Jan 20, 2005 1:20 pm    Post subject: Transpose Negative Sign from Right to Left Reply with quote

A scenario where the amount fields (20 bytes, contains comma, 2 decimal places) have -ve sign on the right.
The commas need to be removed & the sign embedded to the left of the first digit (most significant digit), with the rest of the record written as is.

Sample Input Data

Code:

00000100                      0104                1191005          9400001            17,042,045.72-
00000200                      0111                3205030          9400001         9,118,011,132.05


Output Data

Code:

00000100                      0104                1191005          9400001           -17,042,045.72
00000200                      0111                3205030          9400001         9,118,011,132.05


I would like to do this using SORT instead of a program. Could this be accomplished?
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Thu Jan 20, 2005 1:24 pm    Post subject: Reply with quote

NutCracker,

Is the decimal position variable?

ex:
Code:

----+----1----+--
17,042,045.72-   
9,118,011,132.05


For the 1st record the decimal is at pos 11 and for the 2nd record it is at 14 pos.

Also let us know the following details

LRECL, RECFM , & pos of the amount field which needs be changed

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
NutCracker
Beginner


Joined: 13 Dec 2002
Posts: 45
Topics: 3
Location: 3rd Block from the SUN

PostPosted: Thu Jan 20, 2005 1:30 pm    Post subject: Decimal Position & File Characteristics Reply with quote

The input & output files are FB, length 170
The Dollar Amounts start in col 81
The Decimal point is static in col 98
The negative sign appears (if at all) in col 101
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Thu Jan 20, 2005 1:59 pm    Post subject: Reply with quote

With z/OS DFSORT V1R5 PTF UQ95214 or DFSORT R14 PTF UQ95213 (Dec, 2004), you can use the new SFF (signed free form) format and OVERLAY parameter to do this quite easily and efficiently, as in the following DFSORT job:

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input file
//SORTOUT DD DSN=...  output file
//SYSIN    DD    *
   OPTION COPY
   INREC OVERLAY=(81:81,20,SFF,M18,LENGTH=20)
/*


For complete information on all of the new DFSORT and ICETOOL functions available with this PTF, see:

www.ibm.com/servers/storage/support/software/sort/mvs/pdug/

If you have DFSORT, but don't have the new PTF installed, ask your System Programmer to install it (it's free).
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
NutCracker
Beginner


Joined: 13 Dec 2002
Posts: 45
Topics: 3
Location: 3rd Block from the SUN

PostPosted: Thu Jan 20, 2005 2:13 pm    Post subject: Reply with quote

Frank, Sorry for not mentioning it earlier. Our shop uses Syncsort (1.1BR TPF2A).

I might have your influence to install DFSort. Wink
Back to top
View user's profile Send private message
NutCracker
Beginner


Joined: 13 Dec 2002
Posts: 45
Topics: 3
Location: 3rd Block from the SUN

PostPosted: Thu Jan 20, 2005 2:31 pm    Post subject: Reply with quote

I put in this code to transpose the negative signs, but got a 'NUMERIC FIELD ERROR' message.

Code:

SORT FIELDS=COPY
OUTREC FIELDS=(01:01,80,
                          81:81,19,ZD,EDIT=(STTTTTTTTTTTTTTTTTTT),
                          SIGNS=(,-,,),
                          101,100,70)


Where am I going wrong here?
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Thu Jan 20, 2005 3:15 pm    Post subject: Reply with quote

Quote:
81:81,19,ZD,EDIT=(STTTTTTTTTTTTTTTTTTT),SIGNS=(,-,,),


Nutcracker,

There are several problems with that approach.

1) 81,19,ZD - Syncsort has a limit of 15 bytes for a ZD field. (The new DFSORT PTF raises this limit to 31 for DFSORT.)

2) Your field is of the form dd,ddd,ddd.dds - this cannot be processed as a ZD field because of the commas, decimal point and trailing sign. (The new DFSORT PTF offers the SFF format to process this type of field and many variations.)

Quote:
I might have your influence to install DFSort.


If you or anyone else would like me to send you some files prepared by the DFSORT Team that discuss what we see as the advantages of DFSORT, as well as considerations for migrating from Syncsort to DFSORT, send me an e-mail (yaeger@us.ibm.com) offline. Please put "DFSORT" somewhere in your Subject line to catch my attention.
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
NutCracker
Beginner


Joined: 13 Dec 2002
Posts: 45
Topics: 3
Location: 3rd Block from the SUN

PostPosted: Tue Jan 25, 2005 2:18 am    Post subject: Reply with quote

Frank, Thanks for the information.
I apologise for the late reply.
FYI, I used COBOL instead to achieve this result.
I have sent you an offline mail per your request
Back to top
View user's profile Send private message
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