Sponsored Content
Full Discussion: Parser
Top Forums Shell Programming and Scripting Parser Post 302948753 by nua7 on Thursday 2nd of July 2015 04:39:59 AM
Old 07-02-2015
Parser

Hi All,
I am trying to create a parser to find out what cobol programs are being called by which JCL's.

I need to search recursively until the main cobol program is found being called by a JCL.

I tried to create a script but I am not able to generalize it. Can someone please help.

Code:
#!/usr/bin/sh
set -x
#Create a parser to get the flow of cobol programs until it is being called from a JCL.

export search_dir_cob="/TAHPLIB/CBSRC/"
export search_dir_jcl="/TAHPLIB/PROD/"
jcl_call=true
#cob_prog=CFCS1311
#cob_prog=CLCSS540
export cob_prog=$1

#Replace the 4th character of source with O, to search for the object code being called into the JCL.
obj_code_1=`echo $cob_prog | awk -v pos=4 -v repl=O '{print substr($0,1,pos-1) repl substr($0,pos+1)}'`
grep "RUN $obj_code_1.PROG" ${search_dir_jcl}* 2>/dev/null > tst



#if length of jcl file is greater than 1 stop the search
#put that code later

count=`grep -F 'CALL "'$cob_prog'"' ${search_dir_cob}* | wc -l`
grep -F 'CALL "'$cob_prog'"' ${search_dir_cob}* > cob_search
cat cob_search | cut -d ":" -f1 | cut -d "/" -f4 | cut -d "." -f1 > cob_search1


for i in `cat cob_search1`
do
echo $i | awk -v pos=4 -v repl=O '{print substr($0,1,pos-1) repl substr($0,pos+1)}' | uniq >> cob_search2
done

for i in `cat cob_search2`
do
echo $i | grep "RUN $i.PROG" ${search_dir_jcl}* 2>/dev/null >> tst
done

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

string parser

I am new to scripting I want to parse a string in a loop eg A:B:C:D E:F:G:H and put them in different variable attr1 = A attr2 = B attr3 = C attr4 = D . . /* do processing with attr1, attr2, attr3 and attr4 */ then go to next line E:F:G:H and again assign... (8 Replies)
Discussion started by: flextronics
8 Replies

2. Shell Programming and Scripting

Text Parser

I am having a text file as follows say server.txt Date Time server ip error code -------------------------------------------------------------------------- 02/21/2008 18:10:14 server1 xxx.xxx.xxx.xxx 6 02/21/2008 08:10:14 server2 ... (8 Replies)
Discussion started by: karthikn7974
8 Replies

3. Shell Programming and Scripting

Help with an (easy) parser

Hello, i'm workig with a file with structural information about biological macromolecules (proteins etc). In a certain file, the info is structured like this @<TRIPOS>MOLECULE blah 1 blah 2 blah 3 @<TRIPOS>MOLECULE foo 1 foo 2 foo 3 @<TRIPOS>MOLECULE mmm 1 mmm 2 mmm 3 I would... (7 Replies)
Discussion started by: aristegui
7 Replies

4. Shell Programming and Scripting

need a text parser

i need a simple text parser which can parse a data file created by a softwre so that i can export it to my mysqldb,, datafile created as one record per line with different number of fields. e.g datafile contains following. a=1, b=3, c=4 a=1, c=55, d=abcd a=5, b=hello, c=99, d=help now i... (12 Replies)
Discussion started by: sfaizan
12 Replies

5. Shell Programming and Scripting

xml-parser with perl

Hello I want to write an xml- parser with perl an i use the libary XML::LibXML. I have a problem with the command getElementsByTagName. If there is an empty tag, the getElementsByTagName method returns a NodeList of length zero. how can i check if this is a nodelist of lenght zero?? i... (1 Reply)
Discussion started by: trek
1 Replies

6. Shell Programming and Scripting

Parser with sed

Hi, I have this variable: <a href="http://www.rtve.es/mediateca/videos/20100916/video-calamares-rellenos-salsa-pimientos-garbanzos-16-09-10/878586.shtml">V�deo: Calamares rellenos con salsa de pimientos y ...</a> I would like to have: ... (7 Replies)
Discussion started by: mierdatuti
7 Replies

7. Programming

Parser

Hi Everyone I have an out put of multiple lines which I would like to parse and retrieve certain info from it. The output consists of multiple sections that starts with the line Client: and ends with STL tag: each section separated by an empty line. So basically somehting like Client: ... (10 Replies)
Discussion started by: bombcan1
10 Replies

8. Shell Programming and Scripting

File Parser

Hi need help parsing a file. I have tag fields and values in a file with delimiter |. sample records from the file listed below 8=value|9=value|35=value|49=value|56=value|34=value|50=value|48=value|10=value 8=value|9=value|35=value|49=value|56=value|34=value|51=value|48=value|10=value... (2 Replies)
Discussion started by: subramanian
2 Replies

9. Shell Programming and Scripting

SQL Parser

Hi, I have been assigned a task to migrate few thousands of sql scripts to a different db format. there could be sub queries and complex joins. there would be functions that needs to be replaced from a given list to another values. this should also parse the sub\inline queries. Can you please... (1 Reply)
Discussion started by: hitmansilentass
1 Replies

10. UNIX for Beginners Questions & Answers

Making a parser

input 1..100km 112..403km 500..623km required output 1..51 112..162 500..550 (i.e 50kms added to the initial distance) (2 Replies)
Discussion started by: ANKIT ROY
2 Replies
Vend::Parser(3pm)					User Contributed Perl Documentation					 Vend::Parser(3pm)

NAME
Vend::Parser - Interchange parser class DESCRIPTION
"Vend::Parser" will tokenize a Interchange page when the $p->parse() method is called. The document to parse can be supplied in arbitrary chunks. Call $p->eof() the end of the document to flush any remaining text. The return value from parse() is a reference to the parser object. $self->start($tag, $attr, $attrseq, $origtext) This method is called when a complete start tag has been recognized. The first argument is the tag name (in lower case) and the second argument is a reference to a hash that contain all attributes found within the start tag. The attribute keys are converted to lower case. Entities found in the attribute values are already expanded. The third argument is a reference to an array with the lower case attribute keys in the original order. The fourth argument is the original Interchange page. $self->end($tag) This method is called when an end tag has been recognized. The argument is the lower case tag name. $self->text($text) This method is called when plain text in the document is recognized. The text is passed on unmodified and might contain multiple lines. Note that for efficiency reasons entities in the text are not expanded. COPYRIGHT
Copyright 2002-2007 Interchange Development Group Copyright 1997-2002 Red Hat, Inc. Original HTML::Parser module copyright 1996 Gisle Aas. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. AUTHORS
Vend::Parser - Mike Heins <mike@perusion.com> HTML::Parser - Gisle Aas <aas@sn.no> perl v5.14.2 2010-03-25 Vend::Parser(3pm)
All times are GMT -4. The time now is 12:50 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy