Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Replace Spaces occuring between ? & | with X'00'

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
Puspojit

New User


Joined: 10 Mar 2008
Posts: 34
Location: Pune

PostPosted: Sat Apr 26, 2008 2:15 pm    Post subject: Replace Spaces occuring between ? & | with X'00'
Reply with quote

Hi,
I have an I/p file whose fields are delimited by '|'. This file is unloaded from a table which has nullable fields. So if a particular field has null value
in the table, the corresponding value of it in file after download is spaces
with Null indicator(?) at end of that field.

My task requires to replace the spaces of these fields with X'00' . Please note that the spaces of Nullable fields only need to be replaced and there
will be no spaces /null character in the last field as it contains System date.

Eg:
21|asc| ?| | ?|25-04-2008

Need to replace the spaces of 3rd and 5th field only.
The requirement in a nutshell is how do i replace spaces between ? and |.
Back to top
View user's profile Send private message

saiprasadh

Active User


Joined: 20 Sep 2006
Posts: 154
Location: US

PostPosted: Sat Apr 26, 2008 3:42 pm    Post subject:
Reply with quote

Hi Puspojit,

Try this below Sort Card

Code:
OPTION COPY                                 
ALTSEQ CODE=(4000)                           
OUTREC FIELDS=(1:1,7,8:8,1,TRAN=ALTSEQ,9:9,4,
               13:13,1,TRAN=ALTSEQ,14:14,12)



Thanks
Sai
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Sat Apr 26, 2008 4:25 pm    Post subject:
Reply with quote

why don't you use a CASE in the unload to populate with zero when null?
Back to top
View user's profile Send private message
Puspojit

New User


Joined: 10 Mar 2008
Posts: 34
Location: Pune

PostPosted: Sat Apr 26, 2008 6:04 pm    Post subject: Reply to: Replace Spaces occuring between ? & | with X'0
Reply with quote

Hi Sai,

Thanks for the sort card....it works fine but it would not give the desired result for those nullable fields which have spaces as their value with Null Indicator set off.

Eg : 1|asc| ?| | ?|2500000100
1|asc| | | |2500000100


My requirement is that only the third and fifth field of first record be replaced with X'00' as it has Null Indicator(?) but the second record should not get replaced with X'00' as Null indicator is absent there.

Thus I think there needs to be a condition that shall check that the spaces are between | and ? before replacing them......Please correct me if I am wrong......

Thanks and Regards.
Back to top
View user's profile Send private message
Puspojit

New User


Joined: 10 Mar 2008
Posts: 34
Location: Pune

PostPosted: Sat Apr 26, 2008 6:59 pm    Post subject: Reply to: Replace Spaces occuring between ? & | with X'0
Reply with quote

Hi Dick,

I have not used CASE over here because I want to replace the whole length of 50 bytes(say) for a Nullable field with 50 X'00'....Now this is only possible if I write X'00' 50 times because I guess I cant use the Padding option in the Case statement .....Please give me an example if you think it is possible with the case statement .....I had used the below statement

CASE WHEN NME_MIDDLE IS NULL THEN X'00'
ELSE NME_MIDDLE END

This would fill only one X'00' for that column, the rest shall contain spaces......My requirement is that all the 50 bytes for this field should
be filled with X'00'.....I hope I am clear with my requirement

Thanks in advance....
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10210
Location: italy

PostPosted: Sat Apr 26, 2008 7:05 pm    Post subject: Reply to: Replace Spaces occuring between ? & | with X'0
Reply with quote

Quote:
Now this is only possible if I write X'00' 50 times because I guess


... that will the fastest and less straining solution for your fingers
You have already typed more than 98 zeroes
Back to top
View user's profile Send private message
Puspojit

New User


Joined: 10 Mar 2008
Posts: 34
Location: Pune

PostPosted: Mon Apr 28, 2008 3:32 pm    Post subject: Reply to: Replace Spaces occuring between ? & | with X'0
Reply with quote

Hi Enrico Sorichetti ......

I tried this statement for my requirement

CASE WHEN NME_MIDDLE IS NULL THEN REPEAT(X'00',50)
ELSE NME_MIDDLE END

It works fine but I do not understand how do I use the same statement for a Decimal/date column which are nullable ? Here it works fine as this column is declared as Varchar. Please note that I want to move only Low values(to all columns. irrespective of their types) to the fields having null value in table.

I got my answer by using Case statement(for char fields) and the sort card(for numeric/date fields) given by Sai....Its a bit lenghthy indeed but gives me the desired results.....Please let me know whether there is a shorter and smarter approach

Regards,
Puspojit.
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Mon Apr 28, 2008 11:38 pm    Post subject:
Reply with quote

Puspojit,

If you have used DSNTIAUL program to unload the records from the table, all nullable columns are unloaded with X'00' and there is no need for you to change anything.
Back to top
View user's profile Send private message
Puspojit

New User


Joined: 10 Mar 2008
Posts: 34
Location: Pune

PostPosted: Tue Apr 29, 2008 11:19 am    Post subject: Reply to: Replace Spaces occuring between ? & | with X'0
Reply with quote

Thanks for the info.....I will try the same .
Back to top
View user's profile Send private message
Puspojit

New User


Joined: 10 Mar 2008
Posts: 34
Location: Pune

PostPosted: Tue Apr 29, 2008 11:40 am    Post subject: Reply to: Replace Spaces occuring between ? & | with X'0
Reply with quote

Would there be any performance issue if I use DSNTIAUL instead of
INZUTILB ?

Regards,
Puspojit
Back to top
View user's profile Send private message
saiprasadh

Active User


Joined: 20 Sep 2006
Posts: 154
Location: US

PostPosted: Tue Apr 29, 2008 4:40 pm    Post subject:
Reply with quote

Hi Puspojit,

Try the below Sort Card


Code:
INREC IFTHEN=(WHEN=(9,1,BI,EQ,X'6F'),             
           BUILD=(1:1,7,8:X'00',9:9,17),HIT=NEXT),
      IFTHEN=(WHEN=(14,1,BI,EQ,X'6F'),           
           BUILD=(1:1,12,13:X'00',14:14,17))     
SORT FIELDS=COPY                                 


Thanks
Sai
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Tue Apr 29, 2008 9:04 pm    Post subject:
Reply with quote

Puspojit,

INZUTILB also can pad binary zeroes for null columns and it performs much better than DSNTIAUL.

Saiprasadh,

You are only considering 2 columns with null values. and OP seems to have more than that. Aslo you are only padding 1 byte with binary zeros where as OP wants all the bytes of null able columns to be padded with binary zeros.
Back to top
View user's profile Send private message
Puspojit

New User


Joined: 10 Mar 2008
Posts: 34
Location: Pune

PostPosted: Wed Apr 30, 2008 9:57 am    Post subject: Reply to: Replace Spaces occuring between ? & | with X'0
Reply with quote

Quote:

INZUTILB also can pad binary zeroes for null columns


Hello,
I am sorry but I tried to do the same (albeit,using case statement) but got error for date fields( Error code -311). However I achieved the results
of moving Low-values to Numeric field by Casting them as char and then applying case statement. Eg:

Code:

CASE WHEN CAST(NUM_TENANT AS CHAR(2)) IS NULL THEN REPEAT(X'00',2)
ELSE CAST(NUM_TENANT AS CHAR(5)) END


But I am sure by you meant some other process of achieving the results
since you mentioned "padding".But Padding would pad low values to all
the values occuring in the nullable column.....Please correct me if I am wrong.

I am eager to use the High performance unload utility....Could you please
remove this stumble in my path ?
icon_question.gif
Thanks and Regards,
Puspojit.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Replace repeated JCL with looping REXX prino CLIST & REXX 3 Thu Oct 13, 2016 5:30 am
No new posts To trim spaces in a pipe delimited da... Nish84 COBOL Programming 16 Mon Oct 10, 2016 1:54 pm
This topic is locked: you cannot edit posts or make replies. Sort card to replace text using cross... Susanta SYNCSORT 32 Tue Sep 13, 2016 4:17 pm
No new posts Removing Extra Spaces in a comma sepa... Puspojit DFSORT/ICETOOL 3 Tue Sep 13, 2016 7:46 am
No new posts Replace function abdulrafi COBOL Programming 13 Mon Sep 12, 2016 10:12 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us