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 squeeze out the blanks in two fields

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
balukanna

New User


Joined: 09 Apr 2008
Posts: 41
Location: chennai

PostPosted: Sat Oct 18, 2008 2:22 pm    Post subject: Need to squeeze out the blanks in two fields
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 Moderator


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

PostPosted: Sat Oct 18, 2008 9:18 pm    Post subject:
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: chennai

PostPosted: Mon Oct 20, 2008 9:18 pm    Post subject:
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 Moderator


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

PostPosted: Mon Oct 20, 2008 9:58 pm    Post subject:
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: chennai

PostPosted: Mon Oct 20, 2008 10:04 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts DFSORT MUL FIELDS tspr52 DFSORT/ICETOOL 16 Fri Mar 03, 2017 11:53 pm
No new posts Sort two file having same field, one ... himanshu malik DFSORT/ICETOOL 7 Thu Feb 02, 2017 10:09 am
No new posts SYNCSORT SEQNUM and FI fields. nartcr SYNCSORT 7 Sat Jan 21, 2017 4:02 am
No new posts Syncsort Help to group fields sudhakarraju SYNCSORT 6 Thu Dec 29, 2016 1:38 am
No new posts Access SQLCA fields inside a stored p... gangapd DB2 6 Thu Oct 27, 2016 10:20 am


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