View previous topic :: View next topic |
Author |
Message |
batu544 Beginner
Joined: 02 Aug 2005 Posts: 75 Topics: 27
|
Posted: Thu Feb 23, 2006 4:07 am Post subject: trim all the space from a variable. |
|
|
hi all,
Can anyone tell me how to do solve the following problem?
I have one variable in my program . after reading a file , the field contains some data .
i want to trim all the space from that variable to use that modified variable.
e.g .. inputs are
43Q_36__A
144QCA__100_B
_46__RT_12
My output should be
43Q36A
144QCA100B
46RT12
here i can't use unstring command bcoz the space is not fixed . here one ( _ ) stands for a single space. _________________ Regards,
batu |
|
Back to top |
|
 |
mask-of-zorro Beginner
Joined: 19 Nov 2005 Posts: 23 Topics: 10
|
Posted: Thu Feb 23, 2006 5:05 am Post subject: |
|
|
Hi batu544,
As far as i know, no keywords in COBOL can help this.so incorporate a logic which will take this variable as input,check for spaces in every character..and write it to an array. Wherever spaces are found just skip and if non-blank write it to an output array.
__________________________________________
"No one will listen until you make a mistake" |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
|
|
Back to top |
|
 |
batu544 Beginner
Joined: 02 Aug 2005 Posts: 75 Topics: 27
|
Posted: Thu Feb 23, 2006 6:05 am Post subject: |
|
|
thanks !!!  _________________ Regards,
batu |
|
Back to top |
|
 |
gvnagendrareddy Beginner
Joined: 11 Oct 2007 Posts: 1 Topics: 0
|
Posted: Tue Oct 23, 2007 3:29 pm Post subject: |
|
|
hey i have the same issue can some one help me in this regard
hi all,
Can anyone tell me how to do solve the following problem?
I have one variable in my program . after reading a file , the field contains some data .
i want to trim all the space from that variable to use that modified variable.
e.g .. inputs are
43Q_36__A
144QCA__100_B
_46__RT_12
My output should be
43Q_36_A
144QCA_100_B
46_RT_12
here i can't use unstring command bcoz the space is not fixed . here one ( _ ) stands for a single space.my output should have one psace after each string |
|
Back to top |
|
 |
CraigG Intermediate
Joined: 02 May 2007 Posts: 202 Topics: 0 Location: Viginia, USA
|
Posted: Tue Oct 23, 2007 7:06 pm Post subject: |
|
|
gvnagendrareddy wrote: | hey i have the same issue can some one help me in this regard
hi all,
Can anyone tell me how to do solve the following problem?
I have one variable in my program . after reading a file , the field contains some data .
i want to trim all the space from that variable to use that modified variable.
e.g .. inputs are
43Q_36__A
144QCA__100_B
_46__RT_12
My output should be
43Q_36_A
144QCA_100_B
46_RT_12
here i can't use unstring command bcoz the space is not fixed . here one ( _ ) stands for a single space.my output should have one psace after each string |
I hope you get banned! |
|
Back to top |
|
 |
vkphani Intermediate

Joined: 05 Sep 2003 Posts: 483 Topics: 48
|
Posted: Tue Oct 23, 2007 11:09 pm Post subject: |
|
|
nagendra,
you have to open a new thread. Using a sort tool you can get the desired results. Try the below code.
Code: |
//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD *
43Q 36 A
144QCA 100 B
46 RT 12
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
INREC OVERLAY=(1,80,SQZ=(SHIFT=LEFT,MID=C' '))
/*
|
|
|
Back to top |
|
 |
Frank Yaeger Sort Forum Moderator

Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
|
Posted: Wed Oct 24, 2007 10:06 am Post subject: |
|
|
Actually, the correct DFSORT job would be:
Code: |
//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD *
43Q 36 A
144QCA 100 B
46 RT 12
/*
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
INREC BUILD=(1,80,SQZ=(SHIFT=LEFT,MID=C' '))
/*
|
For more information on DFSORT's SQZ and JFY functions, see:
www.ibm.com/servers/storage/support/software/sort/mvs/peug/ _________________ Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort |
|
Back to top |
|
 |
vkphani Intermediate

Joined: 05 Sep 2003 Posts: 483 Topics: 48
|
Posted: Wed Oct 24, 2007 10:23 am Post subject: |
|
|
Frank,
I got the below error with your code.
Code: | SYSIN :
OPTION COPY
INREC BUILD=(1,80,SQZ=(SHIFT=LEFT,MID=C' '))
*
WER268A INREC STATEMENT : SYNTAX ERROR
WER211B SYNCSMF CALLED BY SYNCSORT; RC=0000
WER449I SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE |
|
|
Back to top |
|
 |
krisprems Beginner

Joined: 13 Dec 2006 Posts: 101 Topics: 4 Location: india
|
Posted: Wed Oct 24, 2007 10:56 am Post subject: |
|
|
vkphani
You are using SYNCSORT, and SYNCSORT doen't have a feature of SQZ  _________________ cHEERs
krisprems |
|
Back to top |
|
 |
vkphani Intermediate

Joined: 05 Sep 2003 Posts: 483 Topics: 48
|
Posted: Wed Oct 24, 2007 11:04 am Post subject: |
|
|
krisprems,
ICEMAN is nothing but DFSORT right. Which pgm should we use for SQZ then? |
|
Back to top |
|
 |
krisprems Beginner

Joined: 13 Dec 2006 Posts: 101 Topics: 4 Location: india
|
Posted: Wed Oct 24, 2007 12:08 pm Post subject: |
|
|
Quote: |
ICEMAN is nothing but DFSORT right. Which pgm should we use for SQZ then?
|
When you give PGM=ICEMAN internally the underlying SORT product in your site is invoked.
Since you have SYNCSORT, when you have provided PGM=ICEMAN, SYNCSORT gets invoked.
You are getting the messages starting from WER****, this means you are using SYNCSORT; if you get ICE**** then you are using DFSORT.
SQZ requires DFSORT feature hence you can't use the same. _________________ cHEERs
krisprems |
|
Back to top |
|
 |
Frank Yaeger Sort Forum Moderator

Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
|
Posted: Wed Oct 24, 2007 2:51 pm Post subject: |
|
|
vkphani,
PGM=ICEMAN and PGM=SORT invoke the primary sort product at your site. In your case, the WER messages indicate the primary sort product at your site is Syncsort, not DFSORT.
The job I provided works fine with DFSORT because DFSORT supports the SQZ function. Syncsort does not support the SQZ function so you can't use it unless your site licenses both Syncsort and DFSORT, which is unlikely. If your site does license both products, then since Syncsort is your primary sort, to use DFSORT you'd have to JOBLIB/STEPLIB to it using the libraries where your System Programmers installed it. _________________ Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort |
|
Back to top |
|
 |
vkphani Intermediate

Joined: 05 Sep 2003 Posts: 483 Topics: 48
|
Posted: Wed Oct 24, 2007 10:22 pm Post subject: |
|
|
Frank and Kris thanks for your inputs. |
|
Back to top |
|
 |
|
|