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

Using Replace option


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

New User


Joined: 14 Jul 2010
Posts: 13
Location: United States

PostPosted: Wed Jul 14, 2010 8:36 pm
Reply with quote

I have an Input file with group names. Some group names might have corresponding asociation name. Following is a sample

City of Joy - > Group name without an association.
AAA/City of sorrow - > Group name with the association name AAA

Assocation name is usually 3 - 6 bytes.

Requirement is to remove the assoction name and keep only teh Group name.

Any suggestions on how I can achieve this?

Thanks
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Wed Jul 14, 2010 11:34 pm
Reply with quote

It's not clear what you want to do or what your data actually looks like.

Are the fields in fixed positions, or are they delimited in some way.

Please show a better example of the records in your input file and what you expect for output. Explain the rules for getting from input to output. Give the RECFM and LRECL of the input file. Give the starting position, length and format of the relevant fields, or explain how the fields are delimited if appropriate.
Back to top
View user's profile Send private message
SORTQUERY

New User


Joined: 14 Jul 2010
Posts: 13
Location: United States

PostPosted: Thu Jul 15, 2010 12:21 am
Reply with quote

Input file is Lrecl- 70. It has Group name - position 1,70.
Few Group are associated with an association and have the association initials at the beginning of the name seperated by '/'.

Following is an example.

GROUP NAME 1
GROUP NAME 2
AAAA/GROUP NAME 3
BBB/GROUP NAME 4
CC/GROUP NAME 5
GROUP NAME 6
.
.
.

My output should be of lrecl = 70

GROUP NAME 1
GROUP NAME 2
GROUP NAME 3
GROUP NAME 4
GROUP NAME 5
GROUP NAME 6
.
.
.
I came up with the following -

Code:
SORT FIELDS=COPY                                       
OUTREC IFTHEN=(WHEN=(2,1,CH,EQ,C'/'),                     
             BUILD=(1:3,68,C'  ')),         
             IFTHEN=(WHEN=(3,1,CH,EQ,C'/'),                     
             BUILD=(1:3,67,C'   ')),         
             IFTHEN=(WHEN=(4,1,CH,EQ,C'/'),                     
             BUILD=(1:5,66,C'    ')),         
             IFTHEN=(WHEN=(5,1,CH,EQ,C'/'),                     
             BUILD=(1:6,65,C'     ')),         
             IFTHEN=(WHEN=(6,1,CH,EQ,C'/'),                     
             BUILD=(1:7,64,C'      ')),         


But this is with an assumption that the association Initials can be of max 6 bytes. This is true for almost all the cases os of now, but there is no check on the length, hence wanted a generic soln.

Let me know if more details are needed.
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Thu Jul 15, 2010 1:00 am
Reply with quote

use the following DFSORT JCL
Code:

//STEP0100 EXEC PGM=SORT                               
//SYSOUT   DD SYSOUT=*                                 
//SORTIN   DD DSN=your input 70 byte FB file,DISP=SHR
//SORTOUT  DD SYSOUT=*                                 
//SYSIN    DD *                                         
  SORT FIELDS=COPY                                     
  INREC IFTHEN=(WHEN=(1,70,SS,EQ,C'/'),                 
  PARSE=(%=(ENDBEFR=C'/'),%1=(FIXLEN=70)),BUILD=(%1))   
//*
Back to top
View user's profile Send private message
SORTQUERY

New User


Joined: 14 Jul 2010
Posts: 13
Location: United States

PostPosted: Thu Jul 15, 2010 2:47 am
Reply with quote

Thanks Kolusu, this worked.

My original requirement was a bit different then what I have posted. Posting the origianl requirement for others to refer.

Following is my exact requirement -
Input File - Lrecl - 1100

I need 3 fields in my output file -
Group Number - position , 1050,9
Section - position 1058.4
Group name - position 33,70.

From the Group name - Remove certain special characters.

Following is the sort parm i developed with the forums help, which seems to be working fine.

Code:

  INREC IFTHEN=(WHEN=(33,70,SS,EQ,C'/'),                     
             PARSE=(%=(ENDBEFR=C'/'),%1=(FIXLEN=70)),     
             BUILD=(1:1050,9,10:1059,4,14:%1)),           
      IFTHEN=(WHEN=NONE,                                   
             BUILD=(1:1050,9,10:1059,4,14:33,70))         
    SORT FIELDS=COPY                                       
    OUTFIL FINDREP=(INOUT=(C'/',C' ',C'\',C'-',C'$',C' ', 
                           C':',C' ',C'.',C' ',C',',C' ', 
                           C'*',C' ',C'"',C' ',C'=',C'-', 
                           C'?',C' ',C'!',C' ',C'|',C' ', 
                           C'>',C' ',C'<',C' ',C';',C' '))


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

New User


Joined: 14 Jul 2010
Posts: 13
Location: United States

PostPosted: Thu Jul 15, 2010 6:59 pm
Reply with quote

Is there a way to apply the parsing for '/' only for the first 10 bytes of the Name field?
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Thu Jul 15, 2010 10:13 pm
Reply with quote

SORTQUERY,

Change your IFTHEN statement to just look for first 10 bytes instead of 70 bytes.
Back to top
View user's profile Send private message
SORTQUERY

New User


Joined: 14 Jul 2010
Posts: 13
Location: United States

PostPosted: Sat Jul 17, 2010 2:07 am
Reply with quote

Thanks Again, icon_smile.gif
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 Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts SCOPE PENDING option -check data DB2 2
No new posts OUTFIL with SAVE option DFSORT/ICETOOL 7
No new posts CICS vs LE: STORAGE option CICS 0
Search our Forums:

Back to Top