MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

how to remove spaces and the word wrap

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
sunilchik
Beginner


Joined: 08 May 2003
Posts: 11
Topics: 4

PostPosted: Mon May 19, 2003 9:02 am    Post subject: how to remove spaces and the word wrap Reply with quote

My sequential file is as follows

Code:

01CP19841231                                                   
TRK=99999999REL=DCLS=NDED=NFLT=NTER=NCOM=NAGE=N               PP
T=99999999REL=NDED=NR45=NAGE=N                    INC=99999999PI
P=NDEV=NPPT=NZON=YNOF=N          COMN PIP=NUMP=NUMA=NUND=NEUB=NU
NF=NPIN=NPID=NEPI=NPIE=NPIC=NPIA=N                             
01CP19850531                                                   
TRK=19850101REL=DCLS=YDED=YFLT=NTER=NCOM=NAGE=N               PP
T=99999999REL=NDED=NR45=NAGE=N                    INC=99999999PI
P=NDEV=YPPT=NZON=YNOF=N          COMN PIP=NUMP=NUMA=NUND=NEUB=NU
NF=NPIN=NPID=NEPI=NPIE=NPIC=NPIA=N                             
01CP19850730                                                   
TRK=19850101REL=DCLS=YDED=YFLT=NTER=NCOM=NAGE=N               PP
T=99999999REL=NDED=NR45=NAGE=N                    INC=99999999PI
P=NDEV=YPPT=NZON=YNOF=N          COMN PIP=NUMP=NUMA=NUND=NEUB=NU
NF=NPIN=NPID=NEPI=NPIE=NPIC=NPIA=NMED=N               


------------------------------------------------------

I need to convert this as

Code:

01CP19841231TRK=99999999REL=DCLS=NDED=NFLT=NTER=NCOM=NAGE=N               PPT=99999999REL=NDED=NR45=NAGE=N                    INC=99999999PIP=NDEV=NPPT=NZON=YNOF=N          COMN PIP=NUMP=NUMA=NUND=NEUB=NUNF=NPIN=NPID=NEPI=NPIE=NPIC=NPIA=N (in one line)
------------------------------------------------------

01CP19850531TRK=19850101REL=DCLS=YDED=YFLT=NTER=NCOM=NAGE=N               PPT=99999999REL=NDED=NR45=NAGE=N                    INC=99999999PIP=NDEV=YPPT=NZON=YNOF=N          COMN PIP=NUMP=NUMA=NUND=NEUB=NUNF=NPIN=NPID=NEPI=NPIE=NPIC=NPIA=N
(in one line)
------------------------------------------------------

01CP19850730TRK=19850101REL=DCLS=YDED=YFLT=NTER=NCOM=NAGE=N               PPT=99999999REL=NDED=NR45=NAGE=N                    INC=99999999PIP=NDEV=YPPT=NZON=YNOF=N          COMN PIP=NUMP=NUMA=NUND=NEUB=NUNF=NPIN=NPID=NEPI=NPIE=NPIC=NPIA=N
(in one line)
------------------------------------------------------


It is not properly showing but what i need is in 3 lines of a sequential file by removing in one place spaces and concatenating the wrapped lines.The existing sequential file has record length as 256.Even then why is it wrapping?Is there any way to do this?
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12375
Topics: 75
Location: San Jose

PostPosted: Mon May 19, 2003 4:38 pm    Post subject: Reply with quote

sunil,

The following DFSORT/ICETOOL JCl will give you the desired results.The first copy operator splits the input file into 3 files. The first line goes to L1 file ,second
line goes to L2 and 3rd line goes to L3 and this process repeats untill eof.

Now we reformat these 3 files,so that we can get the 3 lines as a single
line.

The first line has only 12 bytes and the rest 244 bytes is spaces. so using
ctl2 we reformat the record
Code:

OUTREC=(1,12,512Z,SEQNUM,8,ZD)


This will create a file T1 with LRECL(12+256+256+ 8 BYTES SEQNUM) = 533.
The first 12 bytes will be from the input file and we will have 512 binary
zeroes to accomdate line2 and line3.At the end of each record we will add a
seqnum so that we can use that for sorting

Similary files T2 and T3 are created.

Now the final sort takes in T1,T2 & T3 and sum sorts on the bytes 13 thru
524, so that the 3 lines from the input file will become 1 line.


Code:

//STEP0100 EXEC PGM=ICETOOL
//TOOLMSG  DD  SYSOUT=*
//DFSMSG   DD  SYSOUT=*
//IN       DD  DSN=YOUR INPUT FILE,
//             DISP=SHR
//L1       DD  DSN=&L1,DISP=(,PASS),SPACE=(CYL,(X,Y),RLSE)
//L2       DD  DSN=&L2,DISP=(,PASS),SPACE=(CYL,(X,Y),RLSE)
//L3       DD  DSN=&L3,DISP=(,PASS),SPACE=(CYL,(X,Y),RLSE)
//T1       DD  DSN=&T1,DISP=(,PASS),SPACE=(CYL,(X,Y),RLSE)
//T2       DD  DSN=&T2,DISP=(,PASS),SPACE=(CYL,(X,Y),RLSE)
//T3       DD  DSN=&T3,DISP=(,PASS),SPACE=(CYL,(X,Y),RLSE)
//CON      DD  DSN=&T1,VOL=REF=*.T1,DISP=OLD
//         DD  DSN=&T2,VOL=REF=*.T2,DISP=OLD
//         DD  DSN=&T3,VOL=REF=*.T3,DISP=OLD
//OUT      DD  SYSOUT=*
//TOOLIN   DD  *
  COPY FROM(IN)  USING(CTL1)
  COPY FROM(L1)  USING(CTL2)
  COPY FROM(L2)  USING(CTL3)
  COPY FROM(L3)  USING(CTL4)
  SORT FROM(CON) USING(CTL5)
//CTL1CNTL DD  *
  OUTFIL FNAMES=(L1,L2,L3),SPLIT
//CTL2CNTL DD  *
  OUTFIL FNAMES=T1,OUTREC=(1,12,512Z,SEQNUM,8,ZD)
//CTL3CNTL DD  *
  OUTFIL FNAMES=T2,OUTREC=(12Z,1,256,256Z,SEQNUM,8,ZD)
//CTL4CNTL DD  *
  OUTFIL FNAMES=T3,OUTREC=(12Z,256Z,1,256,SEQNUM,8,ZD)
//CTL5CNTL DD  *
  SORT FIELDS=(525,8,CH,A)
  SUM FIELDS=(13,8,21,8,29,8,37,8,45,8,53,8,61,8,69,8,77,8,85,8,
             93,8,101,8,109,8,117,8,125,8,133,8,141,8,149,8,157,8,
             165,8,173,8,181,8,189,8,197,8,205,8,213,8,221,8,229,8,
             237,8,245,8,253,8,261,8,269,8,277,8,285,8,293,8,301,8,
             309,8,317,8,325,8,333,8,341,8,349,8,357,8,365,8,373,8,
             381,8,389,8,397,8,405,8,413,8,421,8,429,8,437,8,445,8,
             453,8,461,8,469,8,477,8,485,8,493,8,501,8,509,8,517,8),
             FORMAT=BI
  OUTFIL FNAMES=OUT,OUTREC=(1,524)
/*



Hope this helps...

cheers

kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Premkumar
Moderator


Joined: 28 Nov 2002
Posts: 77
Topics: 7
Location: Chennai, India

PostPosted: Mon May 19, 2003 10:45 pm    Post subject: Reply with quote

This can also be achieved using the following method, provided the input file has 3*n fixed length records, where n is an integer.
Code:

//STEP01    EXEC PGM=SORT                     
//SORTIN    DD   DISP=SHR,                   
//          LRECL=768,                       
//*         USE LRECL= 3 * ACTUAL LRECL       
//          DSN=INPUT.FILE                   
//SORTOUT   DD   DISP=(,CATLG,DELETE),       
//          UNIT=SYSDA,SPACE=(CYL,(1,1),RLSE),
//          DSN=OUTPUT.FILE                   
//SYSIN     DD   *                           
  INREC  FIELDS=(1,12,257,512)                 
  SORT   FIELDS=COPY                           
//SYSOUT    DD   SYSOUT=*                     
Back to top
View user's profile Send private message Send e-mail
sunilchik
Beginner


Joined: 08 May 2003
Posts: 11
Topics: 4

PostPosted: Tue May 20, 2003 4:17 am    Post subject: Reply with quote

Guys,

Thanks for the responses

Kolusu,

we dont have DFSORT/ICETOOL ,only ordinary sort I think Syncsort. Is there any way in it??

Premkumar,

I ran your jcl.it was showing invalid LRECL, then i copied it to a dataset of LRECL 768.
but now it is truncating after 12 charcters like this

01CP19841231
TRK=99999999
T=99999999RE
P=NDEV=NPPT=
NF=NPIN=NPID
01CP19850531
TRK=19850101
T=99999999RE
P=NDEV=YPPT=
NF=NPIN=NPID
01CP19850730
TRK=19850101
T=99999999RE
P=NDEV=YPPT=
NF=NPIN=NPID
01CP19851231

Please let me know the syntax of INREC in sort??
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12375
Topics: 75
Location: San Jose

PostPosted: Tue May 20, 2003 5:51 am    Post subject: Reply with quote

sunil,

Change the pgm name to SYNCTOOL and you should be able to get the desired results.

Prem kumar's solution is easy and involves less overhead but only restriction is that blocksize should be a multiple of 3. For a file with LRECL of 256 the optimum blocksize is 27904 which is not a multiple of 3.

kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Premkumar
Moderator


Joined: 28 Nov 2002
Posts: 77
Topics: 7
Location: Chennai, India

PostPosted: Tue May 20, 2003 6:28 am    Post subject: Reply with quote

Sunil,

You will have to copy the input file to a temp file of lrecl=256 and blksize=27648 and use it in sort.

Thanks, Kolusu for pointing out the caveat.
Back to top
View user's profile Send private message Send e-mail
Cogito-Ergo-Sum
Advanced


Joined: 15 Dec 2002
Posts: 637
Topics: 43
Location: Bengaluru, INDIA

PostPosted: Tue May 20, 2003 10:29 am    Post subject: Reply with quote

Premkumar,
I had learnt this trick from this site itself. But, there is another "caveat" here. What if the number of records is NOT a multiple of 3 ?

The input dataset looks like as if it was some kind of dump. So, probably, the solution will always work. Using a LRECL as some multiple of the actual LRECL presumes that, the number of records are going to be that some multiple. What if it is NOT, in a more generic scenario ?
_________________
ALL opinions are welcome.

Debugging tip:
When you have eliminated all which is impossible, then whatever remains, however improbable, must be the truth.
-- Sherlock Holmes.
Back to top
View user's profile Send private message
Premkumar
Moderator


Joined: 28 Nov 2002
Posts: 77
Topics: 7
Location: Chennai, India

PostPosted: Tue May 20, 2003 9:49 pm    Post subject: Reply with quote

If the no. of records is not a multiple of 3, this solution will fail.
Back to top
View user's profile Send private message Send e-mail
sunilchik
Beginner


Joined: 08 May 2003
Posts: 11
Topics: 4

PostPosted: Mon Jun 02, 2003 4:56 am    Post subject: Reply with quote

Thanks guys for the responses.
We had to go for a work around. The input we had to change had only 500 records. So we downloaded the file and the used an ordinary word editor with macros and then uploaded it back to a sequential file with more record length.
And it worked!!!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group