IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Checking wether a string starts from a particular column.


IBM Mainframe Forums -> CLIST & REXX
Post new topic   This topic is locked: you cannot edit posts or make replies.
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
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

Superior Member


Joined: 14 Mar 2007
Posts: 10872
Location: italy

PostPosted: Thu Oct 06, 2016 12:02 pm
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
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

Superior Member


Joined: 14 Mar 2007
Posts: 10872
Location: italy

PostPosted: Thu Oct 06, 2016 12:30 pm
Reply with quote

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

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
Reply with quote

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

Superior Member


Joined: 14 Mar 2007
Posts: 10872
Location: italy

PostPosted: Thu Oct 06, 2016 12:47 pm
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
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: 2455
Location: Hampshire, UK

PostPosted: Thu Oct 06, 2016 2:52 pm
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
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

Superior Member


Joined: 14 Mar 2007
Posts: 10872
Location: italy

PostPosted: Thu Oct 06, 2016 4:44 pm
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. View Bookmarks
All times are GMT + 6 Hours
Forum Index -> CLIST & REXX

 


Similar Topics
Topic Forum Replies
No new posts PARSE Syntax for not fix length word ... JCL & VSAM 7
No new posts Sortjoin and Search for a String and ... DFSORT/ICETOOL 1
No new posts How to load to DB2 with column level ... DB2 6
No new posts RC query -Time column CA Products 3
No new posts file manager is doing string conversion IBM Tools 3
Search our Forums:

Back to Top