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

How to remove DECIMAL POINT (.) from a field in file record


IBM Mainframe Forums -> SYNCSORT
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
amenon308

New User


Joined: 13 Apr 2022
Posts: 4
Location: Hyderabad

PostPosted: Wed Apr 13, 2022 6:57 pm
Reply with quote

Below are record and data,
INPUT
-------------------------------------------------------------
123.23 123.54
99999.77 123.00

DESIRED OUTPUT
------------------------------------------------------------
12323 12354
9999977 12300

Tried below sort card,
OPTION=COPY
INREC FINDREP=(STARTPOS=,ENDPOS=,C'.', C'')

CHALLENGE
--------------
Once .dot operator is removed, its left shifting the data. Desired O/p is decimal point removed with values at exact same position(not left shifting). Please suggest an appropriate sort card for the same.
Note: Values are stores in Alphanumeric fields, hence is left justified.
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2120
Location: USA

PostPosted: Wed Apr 13, 2022 7:12 pm
Reply with quote

Code:
 FINDREP=(INOUT=(C'.',C''))


This is the very first explicit example of FINDREP parameter in any SORT manual
Back to top
View user's profile Send private message
amenon308

New User


Joined: 13 Apr 2022
Posts: 4
Location: Hyderabad

PostPosted: Wed Apr 13, 2022 7:57 pm
Reply with quote

Tried this as already mentioned in my post. Problem is, it is shifting the data to the left after the dot C'.' is replaced with C''.

Do we have option to remove the dot and not shift the data to the left, to maintain the position of fields as is ? This is the main query.

Thanks
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8700
Location: Dubuque, Iowa, USA

PostPosted: Wed Apr 13, 2022 8:17 pm
Reply with quote

You can replace the period with a space. If this is unacceptable, then you need to learn to live with the fact that the data after the period will be shifted to replace the period. If this causes you problems, you need to write a program in the language of your choice to remove the period on a field by field basis.
Back to top
View user's profile Send private message
Garry Carroll

Senior Member


Joined: 08 May 2006
Posts: 1202
Location: Dublin, Ireland

PostPosted: Wed Apr 13, 2022 8:25 pm
Reply with quote

Your desired output shows the data left-shifted and your control card seems to show the replacement as a null (no space between quotes).

Use the code tags to show sample data.

Garry.
Back to top
View user's profile Send private message
amenon308

New User


Joined: 13 Apr 2022
Posts: 4
Location: Hyderabad

PostPosted: Wed Apr 13, 2022 8:46 pm
Reply with quote

Input Record
Code:
-------------------------------------------------------------
123.23  123.54
999.77  123.00


Desired O/p
Code:
-----------------------------------------------------
12323   12354
99977   12300


Current O/p
Code:
-----------------------------------------------------
12323  12354
99977  12300


My control card is not generating desired output. How to add spaces to each field as replacement for the dot(.) so that data remains in right position after sort ?
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1308
Location: Bamberg, Germany

PostPosted: Wed Apr 13, 2022 9:12 pm
Reply with quote

Try SHIFT=NO and/or STARTPOS/ENDPOS parameters.
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2120
Location: USA

PostPosted: Wed Apr 13, 2022 9:30 pm
Reply with quote

If your field positions are fixed, then you can try:

Code:
 BUILD=(1,5,SFF,EDIT=(TTTTT),3X,
        9,5,SFF,EDIT=(TTTTT),3X,
        . . . . )


If your positions are floating, extra PARSE may be required...
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2120
Location: USA

PostPosted: Thu Apr 14, 2022 7:52 pm
Reply with quote

Update: in your example the original fields are 6 characters in length:

Code:
 BUILD=(1,6,SFF,EDIT=(TTTTT),3X,
        9,6,SFF,EDIT=(TTTTT),3X,
        . . . . )
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1308
Location: Bamberg, Germany

PostPosted: Fri Apr 15, 2022 12:19 pm
Reply with quote

For floating points, this snippet could help.

Code:
  OPTION COPY                                   
  INREC IFTHEN=(WHEN=INIT,                     
    BUILD=(1,8,SQZ=(SHIFT=LEFT,PREBLANK=C'.'), 
           9,8,SQZ=(SHIFT=LEFT,PREBLANK=C'.')))
  END
Back to top
View user's profile Send private message
amenon308

New User


Joined: 13 Apr 2022
Posts: 4
Location: Hyderabad

PostPosted: Fri Apr 22, 2022 6:12 pm
Reply with quote

Thanks Joerg.Findeisen. It worked. Given the right output. Thank you all for contributing .
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 -> SYNCSORT

 


Similar Topics
Topic Forum Replies
No new posts how to complete the end of a record w... DFSORT/ICETOOL 2
No new posts Sorting Date Field DFSORT/ICETOOL 4
No new posts Sort based on the record type DFSORT/ICETOOL 1
No new posts how to eliminate null indicator value... DB2 7
No new posts Get RECORD LENGTH, allocated space of... CLIST & REXX 7
Search our Forums:

Back to Top