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 

converting spaces to zeros

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


Joined: 12 Oct 2004
Posts: 7
Topics: 3

PostPosted: Tue Oct 12, 2004 10:29 am    Post subject: converting spaces to zeros Reply with quote

Hi

i have a sequential file (FB) of length 270. The field starting from position 168 is defined as S9(3) COMP-3 and for certain records - this field contain spaces. i need to convert the spaces to zeros for that field for those records.

is it possible to do it by using DFSORT?
Think TRAN=ALTSEQ can convert zeros to spaces but not vice versa.

Thanks
- new user
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Tue Oct 12, 2004 10:55 am    Post subject: Reply with quote

New user,

The following JCL will give you the desired results. We use a change command to change the spaces(x'40') to zeroes(x'00').

Code:

//STEP0100 EXEC PGM=SORT         
//SYSOUT   DD SYSOUT=*           
//SORTIN   DD DSN=YOUR INPUT FILE,
//            DISP=SHR
//SORTOUT  DD DSN=YOUR OUTPUT FILE,
//            DISP=(NEW,CATLG,DELETE),
//            UNIT=SYSDA,
//            SPACE=(CYL,(X,Y),RLSE)
//SYSIN    DD *     
  SORT FIELDS=COPY   
  OUTREC FIELDS=(001,167,                          $ FIRST 167 BYTES AS IS
                 168,2,CHANGE=(2,X'4040',X'000C'), $ CHANGE SPACE TO ZERO
                               NOMATCH=(168,2)     $ PUT IF VALID PD
                 170,101)                          $ REST OF THE FIELDS
/*


Hope this helps...

Cheers

kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


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

PostPosted: Tue Oct 12, 2004 11:51 am    Post subject: Reply with quote

Quote:
is it possible to do it by using DFSORT?
Think TRAN=ALTSEQ can convert zeros to spaces but not vice versa.


DFSORT's TRAN=ALTSEQ can change X'00's to X'40's and X'40's to X'00's. In fact, it can change any hex character to any other hex character.

But as Kolusu pointed out, changing X'4040' to X'0000' will NOT give you the correct type of zeros for your S9(3) COMP-3 since that's a 2-byte PD field for which you need X'000C' to correctly represent a 0 value. Kolusu's DFSORT job uses CHANGE to give you the correct type of 0.

For a table showing the equivalent DFSORT fields for COBOL data types, see the "What are the equivalent DFSORT formats for various COBOL data types?" Ask Professor Sort item at:

http://www.ibm.com/servers/storage/support/software/sort/mvs/professor_sort/
_________________
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


Last edited by Frank Yaeger on Fri Aug 25, 2006 6:26 pm; edited 1 time in total
Back to top
View user's profile Send private message Send e-mail Visit poster's website
new user
Beginner


Joined: 12 Oct 2004
Posts: 7
Topics: 3

PostPosted: Fri Oct 15, 2004 12:11 pm    Post subject: Reply with quote

Thanks a lot Frank and Kolusu.

it really helped

regards
-new user
Back to top
View user's profile Send private message
new user
Beginner


Joined: 12 Oct 2004
Posts: 7
Topics: 3

PostPosted: Tue Oct 26, 2004 7:13 am    Post subject: Reply with quote

Hi Kolusu

i am trying to use the same SYSIN card to convert SPACES,LOW-VALUES and HIGH VALUES to zeros for the same field (starting 168).

in the OUTREC, i am stating
OUTREC FIELDS=(001,167,CHANGE=(2,(X'4040' OR X'FFFF' OR X'0000'),X'000C'),NOMATCH=(168,2),170,101)

But seems - it is incorrect.

Could you please help to get the correct syntax

Thanks
-new user
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Tue Oct 26, 2004 9:34 am    Post subject: Reply with quote

New user,

Your syntax is totally wrong.

try this

Code:

 OUTREC FIELDS=(001,167,CHANGE=(2,X'4040',X'000C',
                                  X'FFFF',X'000C',
                                  X'0000',X'000C'),
                        NOMATCH=(168,2),170,101)



Check this link which explains about the CHANGE parm on OUTREC.(scroll half way)

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/ICE1CA00/3.13?DT=20031124143823

Hope this helps...

Cheers

kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
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