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
 

 

Need to replace junk with default values
Goto page 1, 2  Next
 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
rohanthengal

Active User


Joined: 19 Mar 2009
Posts: 176
Location: Pune, Maharashtra, India

PostPosted: Wed Jan 16, 2013 6:37 pm    Post subject: Need to replace junk with default values
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: 176
Location: Pune, Maharashtra, India

PostPosted: Wed Jan 16, 2013 6:38 pm    Post subject:
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10201
Location: italy

PostPosted: Wed Jan 16, 2013 6:47 pm    Post subject: Reply to: Need to replace junk with default values
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://ftp.software.ibm.com/storage/dfsort/mvs/sorttrck.pdf
Back to top
View user's profile Send private message
dick scherrer

Site Director


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

PostPosted: Wed Jan 16, 2013 8:36 pm    Post subject:
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

Moderator


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

PostPosted: Wed Jan 16, 2013 8:46 pm    Post subject:
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10201
Location: italy

PostPosted: Wed Jan 16, 2013 8:51 pm    Post subject: Reply to: Need to replace junk with default values
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

Site Director


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

PostPosted: Wed Jan 16, 2013 9:16 pm    Post subject: Reply to: Need to replace junk with default values
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    Post subject:
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: 176
Location: Pune, Maharashtra, India

PostPosted: Thu Jan 17, 2013 12:44 am    Post subject:
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: 176
Location: Pune, Maharashtra, India

PostPosted: Thu Jan 17, 2013 12:46 am    Post subject:
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Thu Jan 17, 2013 12:49 am    Post subject: Reply to: Need to replace junk with default values
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: 176
Location: Pune, Maharashtra, India

PostPosted: Thu Jan 17, 2013 12:50 am    Post subject:
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

Site Director


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

PostPosted: Thu Jan 17, 2013 12:53 am    Post subject:
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

Active Member


Joined: 08 May 2006
Posts: 988
Location: Dublin, Ireland / Edinburgh, Scotland

PostPosted: Thu Jan 17, 2013 1:47 pm    Post subject:
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    Post subject:
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    Post subject: Reply to: Need to replace junk with default values
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: 176
Location: Pune, Maharashtra, India

PostPosted: Fri Jan 18, 2013 6:22 pm    Post subject: Reply to: Need to replace junk with default values
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10201
Location: italy

PostPosted: Fri Jan 18, 2013 7:02 pm    Post subject: Reply to: Need to replace junk with default values
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: 176
Location: Pune, Maharashtra, India

PostPosted: Fri Jan 18, 2013 7:29 pm    Post subject:
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

Site Director


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

PostPosted: Fri Jan 18, 2013 8:55 pm    Post subject:
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
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Overlaying one set of charater values... Kevin Lindsley SYNCSORT 7 Sat Nov 05, 2016 3:21 am
No new posts Low values Results from VARCHAR FORMAT balaji81_k DB2 10 Thu Oct 20, 2016 1:18 am
No new posts Replace repeated JCL with looping REXX prino CLIST & REXX 3 Thu Oct 13, 2016 5:30 am
No new posts How can we create a flat file in JAVA... rakesh.v18 Java & MQSeries 7 Fri Sep 23, 2016 10:46 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


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