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

How to extract portions of a field


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

New User


Joined: 15 Dec 2005
Posts: 72
Location: RALEIGH NC, USA

PostPosted: Tue May 22, 2007 1:38 am
Reply with quote

Please help....
I have input record and want to reformat the FIRST-NAME field to remove the blanks between FIRST-NAME and INITIAL. Everything else should remain in teh same position.
We do not have the SQZ option so I would prefer to use OUTREC if possible...as I'm just learning that option

INPUT LRECL = 188 RECFM=FB
Code:
                               
00002JAMES         AMONG           WILKERSON OB/GYN             
00003HUGH          JGRANT          USE # 139410                 
00006JOE           CELLINGTON      KERNODLE CLINIC               
 


Output to hopefully look like this LRECL = 188 RECFM=FB
Code:
                               
DO00002JAMES A        MONG           WILKERSON OB/GYN             
DO00003HUGH J         GRANT          USE # 139410                 
DO00006JOE C          ELLINGTON      KERNODLE CLINIC               
 


I'm just learning OUTREC, but do not know how to remove blanks/spaces
Code:

OPTION COPY             
OUTREC FIELDS=(1:C'DO',
               3:1,5,   
              8:6,15, 
            .
               .
               .
           and so on
)
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 May 23, 2007 5:23 am
Reply with quote

Hello,

If this is something you need soon, i'd suggest putting together a small program to do this. I'm not sure that OUTREC will do what you want. Also, consider that when there is any additional requirement, you may need to write code then.
Back to top
View user's profile Send private message
murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1436
Location: Bangalore,India

PostPosted: Wed May 23, 2007 12:17 pm
Reply with quote

srj1957,

I feel INREC IFTHEN should do the trick (squeeze of spaces) for you. For ref, go thru the following link -

publib.boulder.ibm.com/cgi-bin/bookmgr/BOOKS/ICE1CA20/10.5.14?DT=20060615185603
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 May 23, 2007 7:06 pm
Reply with quote

Hello,

I must admit to being confused icon_smile.gif

Please clarify how the info at that link will remove an unspecified number of embedded spaces from a "field" icon_confused.gif
Back to top
View user's profile Send private message
srj1957

New User


Joined: 15 Dec 2005
Posts: 72
Location: RALEIGH NC, USA

PostPosted: Thu May 24, 2007 1:05 am
Reply with quote

I'm sure it can be done with DFSORT but a bit cumbersome...

I wrote a "quick n dirty" COBOL pgm, which I was hoping to avoid doing

Thanks for your input...
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 May 24, 2007 1:33 am
Reply with quote

You're welcome icon_smile.gif

Also, thank you for posting your solution.
Back to top
View user's profile Send private message
murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1436
Location: Bangalore,India

PostPosted: Thu May 24, 2007 9:55 am
Reply with quote

Dick,

Quote:
Please clarify how the info at that link will remove an unspecified number of embedded spaces from a "field"


I had provided a sample code (whcih was not tested), but I feel it should work.

Code:

//SYSIN DD *
   INREC IFTHEN=(WHEN=(2,1,CH,EQ,C' '),
                           OVERLAY=(3:20,1,         * MOVE INITIAL
                           20:C' ')),      * REASSIGN INITIAL
             IFTHEN=(WHEN=(3,1,CH,EQ,C' '),
                           OVERLAY=(4:20,1,         * MOVE INITIAL
                            20:C' ')),      * REASSIGN INITIAL
                       ........
                       ........
   OPTION COPY
   OUTREC FIELDS=(C'DO',            * ADD 'DO' AT THE BEGIN
                              1,N)               * REMAINING RECORD
/*
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: Mon May 28, 2007 1:01 am
Reply with quote

Quote:
We do not have the SQZ option so I would prefer to use OUTREC if possible...as I'm just learning that option


SQZ is a parameter of OUTREC (=BUILD). With DFSORT's SQZ function, you could do it like this:

Code:

  OPTION COPY                         
  INREC BUILD=(1:C'DO',               
    3:1,5,                             
    8:6,15,SQZ=(SHIFT=LEFT,MID=C' '), 
    23:...)


You'll need z/OS DFSORT V1R5 PTF UK90007 or DFSORT R14 PTF UK90006 (April, 2006) in order to use DFSORT's SQZ function. If you don't have the April, 2006 PTF, ask your System Programmer to install it (it's free).

You could probably do the same thing with a lot of IFTHEN statements, but it would be better to get your System Programmer to install the PTF so you can use SQZ.
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 Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts Need help for File Aid JCL to extract... Compuware & Other Tools 23
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts Join 2 files according to one key field. JCL & VSAM 3
No new posts optim extract file - SAS DB2 2
Search our Forums:

Back to Top