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 

trim all the space from a variable.

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


Joined: 02 Aug 2005
Posts: 75
Topics: 27

PostPosted: Thu Feb 23, 2006 4:07 am    Post subject: trim all the space from a variable. Reply with quote

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
View user's profile Send private message Yahoo Messenger MSN Messenger
mask-of-zorro
Beginner


Joined: 19 Nov 2005
Posts: 23
Topics: 10

PostPosted: Thu Feb 23, 2006 5:05 am    Post subject: Reply with quote

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
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Thu Feb 23, 2006 5:45 am    Post subject: Reply with quote

batu544,

Please search before posting. check this topic which discusses the exact same issue

http://mvsforums.com/helpboards/viewtopic.php?t=4658&highlight=inspect

Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
batu544
Beginner


Joined: 02 Aug 2005
Posts: 75
Topics: 27

PostPosted: Thu Feb 23, 2006 6:05 am    Post subject: Reply with quote

thanks !!! Smile
_________________
Regards,
batu
Back to top
View user's profile Send private message Yahoo Messenger MSN Messenger
gvnagendrareddy
Beginner


Joined: 11 Oct 2007
Posts: 1
Topics: 0

PostPosted: Tue Oct 23, 2007 3:29 pm    Post subject: Reply with quote

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
View user's profile Send private message
CraigG
Intermediate


Joined: 02 May 2007
Posts: 202
Topics: 0
Location: Viginia, USA

PostPosted: Tue Oct 23, 2007 7:06 pm    Post subject: Reply with quote

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
View user's profile Send private message
vkphani
Intermediate


Joined: 05 Sep 2003
Posts: 483
Topics: 48

PostPosted: Tue Oct 23, 2007 11:09 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Wed Oct 24, 2007 10:06 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
vkphani
Intermediate


Joined: 05 Sep 2003
Posts: 483
Topics: 48

PostPosted: Wed Oct 24, 2007 10:23 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
krisprems
Beginner


Joined: 13 Dec 2006
Posts: 101
Topics: 4
Location: india

PostPosted: Wed Oct 24, 2007 10:56 am    Post subject: Reply with quote

vkphani
You are using SYNCSORT, and SYNCSORT doen't have a feature of SQZ Neutral
_________________
cHEERs
krisprems
Back to top
View user's profile Send private message
vkphani
Intermediate


Joined: 05 Sep 2003
Posts: 483
Topics: 48

PostPosted: Wed Oct 24, 2007 11:04 am    Post subject: Reply with quote

krisprems,

ICEMAN is nothing but DFSORT right. Which pgm should we use for SQZ then?
Back to top
View user's profile Send private message Send e-mail
krisprems
Beginner


Joined: 13 Dec 2006
Posts: 101
Topics: 4
Location: india

PostPosted: Wed Oct 24, 2007 12:08 pm    Post subject: Reply with quote

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
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Wed Oct 24, 2007 2:51 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
vkphani
Intermediate


Joined: 05 Sep 2003
Posts: 483
Topics: 48

PostPosted: Wed Oct 24, 2007 10:22 pm    Post subject: Reply with quote

Frank and Kris thanks for your inputs.
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming 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