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
 

 

Checking wether a string starts from a particular column.

 
Post new topic   This topic is locked: you cannot edit posts or make replies.    IBMMAINFRAMES.com Support Forums -> CLIST & REXX
View previous topic :: :: View next topic  
Author Message
sundaram.naveen
Warnings : 1

New User


Joined: 06 Oct 2016
Posts: 19
Location: India

PostPosted: Thu Oct 06, 2016 11:56 am    Post subject: Checking wether a string starts from a particular column.
Reply with quote

Hi!

My requirement is I have been given a ps file. Let's say the PS file is a cobol code and it has a key word 'ABC' . I need to verify whether ABC starts from a particular column say 8. If it is not then I need to change it to column 8 and write it in a NEW PS File. Similarly I need to do this for 'EDF' too. So I would like to know how do I get started with this.
Back to top
View user's profile Send private message

enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10203
Location: italy

PostPosted: Thu Oct 06, 2016 12:02 pm    Post subject: Reply to: Checking wether a string starts from a particular column.
Reply with quote

post a sample of the input data, and a sample of the output data

for large datasets REXX is not the best language ,
a <Your SORT> solution might provide a better performance
Back to top
View user's profile Send private message
sundaram.naveen
Warnings : 1

New User


Joined: 06 Oct 2016
Posts: 19
Location: India

PostPosted: Thu Oct 06, 2016 12:14 pm    Post subject: Reply to: Checking wether a string starts from a particular column.
Reply with quote

I want all the PIC clause to start from col40(say). Below is my sample in put and my expected output

******INPUT*******
Code:

005900 01  SORTED-RECORD.
006000     05  WS-SR-ACCT-NO       PIC X(05).
006100     05  FILLER              PIC X(05).
006200     05  WS-SR-AMOUNT         PIC 9(05).
006300     05  WS-SR-CUST-NAME      PIC X(10).
006400     05  FILLER              PIC X(55).

******OUTPUT*****
Code:

005900 01  SORTED-RECORD.
006000     05  WS-SR-ACCT-NO        PIC X(05).
006100     05  FILLER               PIC X(05).
006200     05  WS-SR-AMOUNT         PIC 9(05).
006300     05  WS-SR-CUST-NAME      PIC X(10).
006400     05  FILLER               PIC X(55).


The above code is a part of a cobol program. I also need to make sure all the 'TO' variables are starting at col40 too. So it's like a review/correction that needs to be done on the input file and give a final sorted output file
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10203
Location: italy

PostPosted: Thu Oct 06, 2016 12:30 pm    Post subject: Reply to: Checking wether a string starts from a particular column.
Reply with quote

take look at my $apply Rexx script which will apply an edit macro to all the members of a pds

http://www.ibmmainframes.com/viewtopic.php?t=25947

You will gave to write the inner macro Yourself
Back to top
View user's profile Send private message
sundaram.naveen
Warnings : 1

New User


Joined: 06 Oct 2016
Posts: 19
Location: India

PostPosted: Thu Oct 06, 2016 12:39 pm    Post subject: Reply to: Checking wether a string starts from a particular column.
Reply with quote

can you please help me out ?
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10203
Location: italy

PostPosted: Thu Oct 06, 2016 12:47 pm    Post subject: Reply to: Checking wether a string starts from a particular column.
Reply with quote

to help You I / we all need to know EXACTLY where You stand as far as the REXX skill level

a Forum is to HELP when somebody find an obstacle,
not to provide step by step guidance in performing a task

how much did You understand of the script I pointed You to ?
Back to top
View user's profile Send private message
sundaram.naveen
Warnings : 1

New User


Joined: 06 Oct 2016
Posts: 19
Location: India

PostPosted: Thu Oct 06, 2016 1:11 pm    Post subject: Reply to: Checking wether a string starts from a particular column.
Reply with quote

I meant what you have done in the script. I told you I am a beginner. I am still learning. I need a heads up or lead from where I could start with the logic
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 1715
Location: UK

PostPosted: Thu Oct 06, 2016 2:52 pm    Post subject:
Reply with quote

Look up the functions that del with WORDs and POSitions
That will tell you if the word is on a line and where it is
Split the line and re-assemble with extra/fewer blanks to align as you want

But, what if the position (40) is not blank? Where is the second part of the line to be positioned? A new line?
Back to top
View user's profile Send private message
sundaram.naveen
Warnings : 1

New User


Joined: 06 Oct 2016
Posts: 19
Location: India

PostPosted: Thu Oct 06, 2016 3:51 pm    Post subject: Reply to: Checking wether a string starts from a particular column.
Reply with quote

Yes Nic , a new line. But then we should also identify if the entire string can be accommodated in a single line without changing the starting position of the string. If it fails it then we should move to a new line starting from the variable that needs to come at the 40 position.
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10203
Location: italy

PostPosted: Thu Oct 06, 2016 4:44 pm    Post subject: Reply to: Checking wether a string starts from a particular column.
Reply with quote

if the question asked is just a small detail of a larger requirement/task
( as You said in Your PM )

which I guess is a COBOL reformatter/normaliser
I think that it is a task above the skill level of a beginner
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   This topic is locked: you cannot edit posts or make replies.    IBMMAINFRAMES.com Support Forums -> CLIST & REXX All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts SQZ pipe delimited file with 1 column... Rick Silvers DFSORT/ICETOOL 2 Sun Nov 06, 2016 8:11 pm
No new posts Syncsort - NULL in Integer field chec... nartcr SYNCSORT 4 Thu Oct 06, 2016 6:47 am
No new posts Reasonable way of checking wildcards ... sergeyken CLIST & REXX 5 Wed Sep 07, 2016 8:43 pm
No new posts Random Password (in string format) ge... ezhavendhan COBOL Programming 10 Mon Aug 29, 2016 3:18 pm
No new posts Add system date inside of a PS file a... pramitdas DFSORT/ICETOOL 5 Sun Aug 28, 2016 12:06 am


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