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

Need to replace junk with default values


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
rohanthengal

Active User


Joined: 19 Mar 2009
Posts: 206
Location: Globe, India

PostPosted: Wed Jan 16, 2013 6:37 pm
Reply with quote

I want to replace junks in file fields with some default value. Can i accomplish this task with DFSORT options ?
Code:
example: length of input file can be 5
INPUT FILE
-------------
YAY.Y
.AYYY
Y.Y.Y
YA..Y
YRN..
assume . =junk character

I want to check for all places in records for junks like..
1) for first field in input file, i have to check ---
IF it is not 'Y' or 'N' then replace it with default value 'N'
2) for second field in input file, i have to check ---
IF it is not 'A'or 'R then replace it with default value 'R'
3) for third field in input file, i have to check ---
IF it is not 'Y'or 'N' then replace it with default value 'N'
4) for fourth field in input file, i have to check ---
IF it is not 'Y'or 'N' then replace it with default value 'N'
5) for fifth field in input file, i have to check ---
IF it is not 'Y'or 'N' then replace it with default value 'N'

OUTPUT FILE should be as below
-------------------------------------
Code:
YAYNY
NAYYY
YRYNY
YANNY
YRNNN

Let me know if we can do this with sort options/how or eazytrieve...
Which option would be better from performance point of view ?
Back to top
View user's profile Send private message
rohanthengal

Active User


Joined: 19 Mar 2009
Posts: 206
Location: Globe, India

PostPosted: Wed Jan 16, 2013 6:38 pm
Reply with quote

this will help me to recreate file in case of any accidental damage.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Wed Jan 16, 2013 6:47 pm
Reply with quote

You have been here long enough that You should not have had the need to ask

nothing that INREC IFTHEN OVERLAY would not be able to achieve

why not search the forum

or meditate on
ftp.software.ibm.com/storage/dfsort/mvs/sorttrck.pdf
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Wed Jan 16, 2013 8:36 pm
Reply with quote

Hello,

Quote:
this will help me to recreate file in case of any accidental damage.

If this "file" you are creating will have only specific values, how will this help recreating the file? How does a file "accidentally" get damaged so that the values can be "reset" this way icon_confused.gif
Back to top
View user's profile Send private message
Pandora-Box

Global Moderator


Joined: 07 Sep 2006
Posts: 1592
Location: Andromeda Galaxy

PostPosted: Wed Jan 16, 2013 8:46 pm
Reply with quote

Quote:
this will help me to recreate file in case of any accidental damage.


Why not ensure a process which is accident free?
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Wed Jan 16, 2013 8:51 pm
Reply with quote

Quote:
How does a file "accidentally" get damaged

the same way a damsel gets unexpectedly/accidentally pregnant icon_cool.gif
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Wed Jan 16, 2013 9:16 pm
Reply with quote

Took something seriously that was poked at her in fun . . . icon_neutral.gif

d
Back to top
View user's profile Send private message
Anbarasan D

New User


Joined: 20 Apr 2010
Posts: 21
Location: USA

PostPosted: Thu Jan 17, 2013 12:29 am
Reply with quote

try this

Code:
  OPTION COPY                                           
  INREC IFTHEN=(WHEN=(1,1,CH,NE,C'Y',AND,1,1,CH,NE,C'N'),
        OVERLAY=(1:C'N'),HIT=NEXT),                     
        IFTHEN=(WHEN=(2,1,CH,NE,C'A',AND,2,1,CH,NE,C'R'),
        OVERLAY=(2:C'R'),HIT=NEXT),                     
        IFTHEN=(WHEN=(3,1,CH,NE,C'Y',AND,3,1,CH,NE,C'N'),
        OVERLAY=(3:C'N'),HIT=NEXT),                     
        IFTHEN=(WHEN=(4,1,CH,NE,C'Y',AND,4,1,CH,NE,C'N'),
        OVERLAY=(4:C'N'),HIT=NEXT),                     
        IFTHEN=(WHEN=(5,1,CH,NE,C'Y',AND,5,1,CH,NE,C'N'),
        OVERLAY=(5:C'N'))                               
Back to top
View user's profile Send private message
rohanthengal

Active User


Joined: 19 Mar 2009
Posts: 206
Location: Globe, India

PostPosted: Thu Jan 17, 2013 12:44 am
Reply with quote

Can i go for Easytrieve ?
Performancewise both option look are same...
Back to top
View user's profile Send private message
rohanthengal

Active User


Joined: 19 Mar 2009
Posts: 206
Location: Globe, India

PostPosted: Thu Jan 17, 2013 12:46 am
Reply with quote

@Pandro.. you know if there is something called as 'Risk Management..'
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Thu Jan 17, 2013 12:49 am
Reply with quote

Yes, it can be done it Easytrieve.
Back to top
View user's profile Send private message
rohanthengal

Active User


Joined: 19 Mar 2009
Posts: 206
Location: Globe, India

PostPosted: Thu Jan 17, 2013 12:50 am
Reply with quote

@enrico, i agree, but i am still in learning phase... i can help on whatever i learned here..for sure..Thank you
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Thu Jan 17, 2013 12:53 am
Reply with quote

Hello,

Quote:
Performancewise both option look are same...
Why do you believe this?
Back to top
View user's profile Send private message
Garry Carroll

Senior Member


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

PostPosted: Thu Jan 17, 2013 1:47 pm
Reply with quote

Anbarasan D wrote:
try this

Code:
  OPTION COPY                                           
  INREC IFTHEN=(WHEN=(1,1,CH,NE,C'Y',AND,1,1,CH,NE,C'N'),
        OVERLAY=(1:C'N'),HIT=NEXT),                     
        IFTHEN=(WHEN=(2,1,CH,NE,C'A',AND,2,1,CH,NE,C'R'),
        OVERLAY=(2:C'R'),HIT=NEXT),                     
        IFTHEN=(WHEN=(3,1,CH,NE,C'Y',AND,3,1,CH,NE,C'N'),
        OVERLAY=(3:C'N'),HIT=NEXT),                     
        IFTHEN=(WHEN=(4,1,CH,NE,C'Y',AND,4,1,CH,NE,C'N'),
        OVERLAY=(4:C'N'),HIT=NEXT),                     
        IFTHEN=(WHEN=(5,1,CH,NE,C'Y',AND,5,1,CH,NE,C'N'),
        OVERLAY=(5:C'N'))                               


Why not...
Code:
  OPTION COPY                                           
  INREC IFTHEN=(WHEN=(1,1,CH,NE,C'Y'),
        OVERLAY=(1:C'N'),HIT=NEXT),                     
        IFTHEN=(WHEN=(2,1,CH,NE,C'A'),
        OVERLAY=(2:C'R'),HIT=NEXT),                     
        IFTHEN=(WHEN=(3,1,CH,NE,C'Y'),
        OVERLAY=(3:C'N'),HIT=NEXT),                     
        IFTHEN=(WHEN=(4,1,CH,NE,C'Y'),
        OVERLAY=(4:C'N'),HIT=NEXT),                     
        IFTHEN=(WHEN=(5,1,CH,NE,C'Y'),
        OVERLAY=(5:C'N'))                               


There's no need to check for a value if you're going to change it to the same value anyway.

Garry
Back to top
View user's profile Send private message
Anbarasan D

New User


Joined: 20 Apr 2010
Posts: 21
Location: USA

PostPosted: Fri Jan 18, 2013 3:17 am
Reply with quote

I got it. Thanks icon_smile.gif
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Fri Jan 18, 2013 5:49 am
Reply with quote

A simpler approach is to use the CHANGE command.
Code:

//STEP0100 EXEC PGM=SORT                                   
//SYSOUT   DD SYSOUT=*                                     
//SORTIN   DD *                                             
YAY.Y                                                       
.AYYY                                                       
Y.Y.Y                                                       
YA..Y                                                       
YRN..                                                       
//SORTOUT  DD SYSOUT=*                                     
//SYSIN    DD *                                             
  OPTION COPY                                               
  INREC OVERLAY=(1:1,1,CHANGE=(1,C'Y',C'Y'),NOMATCH=(C'N'),
                 2:2,1,CHANGE=(1,C'A',C'A'),NOMATCH=(C'R'),
                 3:3,1,CHANGE=(1,C'Y',C'Y'),NOMATCH=(C'N'),
                 4:4,1,CHANGE=(1,C'Y',C'Y'),NOMATCH=(C'N'),
                 5:5,1,CHANGE=(1,C'Y',C'Y'),NOMATCH=(C'N'))
//*                                                         


the output from this
Code:

YAYNY
NAYYY
YRYNY
YANNY
YRNNN
Back to top
View user's profile Send private message
rohanthengal

Active User


Joined: 19 Mar 2009
Posts: 206
Location: Globe, India

PostPosted: Fri Jan 18, 2013 6:22 pm
Reply with quote

Skolusu, i think this optin can not check range if required..
e.g. if i want to check for one place if it is not in the range of 000 to 100 then reset to 000.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Fri Jan 18, 2013 7:02 pm
Reply with quote

and how does the last question relate to the initial one ???
Back to top
View user's profile Send private message
rohanthengal

Active User


Joined: 19 Mar 2009
Posts: 206
Location: Globe, India

PostPosted: Fri Jan 18, 2013 7:29 pm
Reply with quote

@Anbarasan D & @Garry Carroll

This is perfect PLUS optimized one... icon_biggrin.gif

Which one should be opted performancewise
1. Eazytriev or
2. given SORT

When i tried, i found both are almost equal but only few programmers who are more used to Eazytrieve, are using Eazytrieve and
those new generation who is more familer with SORT CARDs, prefers it because of many in one advantages...

Let me know if wrong.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Fri Jan 18, 2013 8:55 pm
Reply with quote

Hello,

Quote:
When i tried, i found both are almost equal but only few programmers who are more used to Eazytrieve, are using Eazytrieve and
those new generation who is more familer with SORT CARDs, prefers it because of many in one advantages...

Let me know if wrong.
What do you mean "almost equal"?

If the local standards permit the use of either, then either should be ok.

From what i've seen many places, sort will perform better than Easytrieve for large volumes of data. Easytrieve is intended to be an entire programming language. I believe that neither is the tool for "everything". One should determine the better tool for the job and use that tool. Have you ever seen a master carpenter with only one saw?
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Sat Jan 19, 2013 2:29 am
Reply with quote

rohanthengal wrote:
Skolusu, i think this optin can not check range if required..
e.g. if i want to check for one place if it is not in the range of 000 to 100 then reset to 000.


rohanthengal,

You are provided with a solution specific to the requirements posted in your first post. We cannot read your mind or requirements. Post detailed information on what you're trying to accomplish. Do not make people guess what you mean. This will give you a much better chance of getting a good answer to your question.

Please Seek solutions instead of Shopping for solutions.
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 -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts Null values are considered in Total c... DFSORT/ICETOOL 6
Search our Forums:

Back to Top