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

Need to squeeze out the blanks in two fields


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

New User


Joined: 09 Apr 2008
Posts: 41
Location: USA

PostPosted: Sat Oct 18, 2008 2:22 pm
Reply with quote

Hi..

I need to squeeze out blanks, but one space between the words in two field, the field length should remain same and to do this on records after header (header first 2 line).


File Layout:

SRNO- 10
NAME- 10
DESC- 30
COMMENT - 30

For Ex:
In field DESC and COMMENT the values are like this

Input

DESC
****

Code:
AAAAAA
ZZZ             Y
   SSS     BBBB


COMMENT
********

Code:
AAA       ZZZZ
             XXXXX



Output

DESC
*****

Code:
AAAAAA
ZZZ Y
SSS BBBB


COMMENT
********
Code:

AAA ZZZZ
XXXXX
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: Sat Oct 18, 2008 9:18 pm
Reply with quote

Your description is rather confusing and you mention two headers that you don't show in your example, but if you want to squeeze out all but one blank between fields starting with record 3, you can use a DFSORT job like this:

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input file (FB/80)
//SORTOUT DD DSN=...  output file (FB/80)
//SYSIN    DD    *
  OPTION COPY
  INREC IFOUTLEN=80,
    IFTHEN=(WHEN=INIT,OVERLAY=(81:SEQNUM,8,ZD)),
    IFTHEN=(WHEN=(81,8,ZD,GT,+2),
      OVERLAY=(1:1,80,SQZ=(SHIFT=LEFT,MID=C' ')))
/*
Back to top
View user's profile Send private message
balukanna

New User


Joined: 09 Apr 2008
Posts: 41
Location: USA

PostPosted: Mon Oct 20, 2008 9:18 pm
Reply with quote

Hi Frank,
Sorry for the confusion, will give you an example below with some more clarity...

More than one blank should be squeezed in DESC and COMMENTs only, Field length is DESC (from 21 to 50 (30)), COMMENTS (from 51 to 80 (30) ), Header two line.


INPUT FILE:


Code:
SRNO      NAME      DESC                       COMMENTS
***************************************************************
01        XXX        ABC RES     TYU           AAA    BBB     CCC
02        YYY         ADD      WE              DDDDD       DD
                             NO     XXXX           FF      XXXX
03        ZZZ        TTTTT                          RRR    R



OUTPUT FILE:

Code:
SRNO      NAME      DESC                         COMMENTS
*************************************************************
01        XXX      ABC RES TYU                   AAA BBB CCC
02        YYY      ADD WE                        DDDDD DD
                   NO XXXX                       FF XXXX
03        ZZZ      TTTTT                         RRR R


__________________
Balukanna

Hope this will be clear
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 Oct 20, 2008 9:58 pm
Reply with quote

If the two header records can be identified as having 'SRNO' and '****' in positions 1-4, then you can use a DFSORT job like this:

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input file (FB/80)
//SORTOUT DD DSN=...  output file (FB/80)
//SYSIN    DD    *
  OPTION COPY                                                       
  INREC IFTHEN=(WHEN=(1,4,CH,NE,C'SRNO',AND,1,4,CH,NE,C'****'),     
      OVERLAY=(21:21,30,SQZ=(SHIFT=LEFT,MID=C' '),                 
               51:51,30,SQZ=(SHIFT=LEFT,MID=C' ')))                 
/*


If the two header records can only be identified as the first two records, then you can use a DFSORT job like this:

Code:

//S2    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input file (FB/80)
//SORTOUT DD DSN=...  output file (FB/80)
//SYSIN    DD    *
  OPTION COPY                                         
  INREC IFOUTLEN=80,                                   
    IFTHEN=(WHEN=INIT,OVERLAY=(81:SEQNUM,8,ZD)),       
    IFTHEN=(WHEN=(81,8,ZD,GT,+2),                     
      OVERLAY=(21:21,30,SQZ=(SHIFT=LEFT,MID=C' '),     
               51:51,30,SQZ=(SHIFT=LEFT,MID=C' ')))   
/*
Back to top
View user's profile Send private message
balukanna

New User


Joined: 09 Apr 2008
Posts: 41
Location: USA

PostPosted: Mon Oct 20, 2008 10:04 pm
Reply with quote

Thanks frank..

Will Try it...
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 Delete file row if blanks in the firs... DFSORT/ICETOOL 5
No new posts Concatenate 2 fields (usage national)... COBOL Programming 2
No new posts Cobol COMP-2 fields getting scrambled... Java & MQSeries 6
No new posts Converting unpacked fields to pack us... SYNCSORT 4
No new posts Data for newly added fields not displ... IMS DB/DC 6
Search our Forums:

Back to Top