Renumbering of COBOL Source code


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Renumbering of COBOL Source code
# 1  
Old 11-02-2012
Lightbulb Renumbering of COBOL Source code

Hi,

I have written awk script to replicate RENUM function of ISPF.

Please anyone has simple script than that.

awk '{i=i+10;line=substr($0,7,73); printf("%06d%s\n", i, line) }' ABC.cob

where ABC.cob is Cobol source code.
# 2  
Old 11-02-2012
Looks OK to me. I dont't think, it can be done much easier, just in a different way :-)
# 3  
Old 11-02-2012
I haven't written any COBOL in more than 30 years and even then I wasn't a big fan of GOTO. But, it used to be fairly common practice to have the source line number be part of the paragraph label used as the target of a GOTO statement. If that is being done in the source you're renumbering, you may need to consider altering more than just the line number fields while you're updating the code.
# 4  
Old 11-03-2012
Code:
awk '{printf("%05d0%s\n", NR, substr($0,7,73)) }' ABC.cob

# 5  
Old 11-03-2012
Actually, none of the suggestions handle the case wherein any line of COBOL source code starts with tabs. In these cases, each of these solutions might eat up parts of actual source code.

Last edited by elixir_sinari; 11-03-2012 at 11:15 AM..
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Renumbering files bash script

I am new to the world of Linux scripting, and would like to make the following 2 scripts: I have 67 files named Alk-0001.txt to Alk-0067.txt I would like them to be numbered Alk-002.txt to Alk-0134.txt eg Alk-0001.txt > Alk-0002.txt Alk-0002.txt > Alk-0004.txt Alk-0003.txt > Alk-0006.txt ... (3 Replies)
Discussion started by: tollyboy_uk
3 Replies

2. Shell Programming and Scripting

Block of code replacement in Java source code through Unix script

Hi, I want to remove the following code from Source files (or replace the code with empty.) from all the source files in given directory. finally { if (null != hibernateSession && hibernateSession.isOpen()) { //hibernateSession.close(); } } It would be great if the script has... (2 Replies)
Discussion started by: hareeshram
2 Replies

3. Shell Programming and Scripting

renumbering within a file

Hi All, I have 100 files named - rep-0.txt, rep-2.txt...rep-99.txt. They each contain information in the following format: abc 1 qwe asd 2 zxc poi 3 lkj pdh 4 ldf hgf 5 tyu i would like to re-number , so that all the new files (rep0.dat, rep1,dat....) have... (1 Reply)
Discussion started by: chen.xiao.po
1 Replies

4. UNIX for Dummies Questions & Answers

renaming (renumbering) fasta files

I have a fasta file that looks like this: >Noname ACCAAAATAATTCATGATATACTCAGATCCATCTGAGGGTTTCACCACTTGTAGAGCTAT CAGAAGAATGTCAATCAACTGTCCGAGAAAAAAGAATCCCAGG >Noname ACTATAAACCCTATTTCTCTTTCTAAAAATTGAAATATTAAAGAAACTAGCACTAGCCTG ACCTTTAGCCAGACTTCTCACTCTTAATGCTGCGGACAAACAGA ... I want to... (2 Replies)
Discussion started by: Oyster
2 Replies

5. Shell Programming and Scripting

Calling script from RM cobol and returning value to cobol

Is there a way you can return a value from a script that is called from a rm cobol program... 01 WS-COMD-LINE-PGM X(39) value sh ./getUserId.sh 12345" 01 WS-RETURN-SYS-CODE PIC 9(8). CALL "SYSTEM" USING WS-COMD-LINE-PGM GIVING WS-RETURN-SYS-CODE. ... (1 Reply)
Discussion started by: pavanmp
1 Replies

6. Shell Programming and Scripting

column renumbering

Hi, I am a beginner in awk scripting! I need your help; I want to replace the fifth column number (which is 15 here) here in this file for example : ATOM 142 N PRO A 15 ATOM 143 CD PRO A 15 ATOM 144 HD1 PRO A 15 ATOM ... (5 Replies)
Discussion started by: adak
5 Replies

7. Programming

cobol crn programme run on express cobol as .gnt

can i run .crn programme in express cobol which support to .gnt programme .... Plz tell me solution (2 Replies)
Discussion started by: bibi
2 Replies

8. Shell Programming and Scripting

Renumbering files scripting help!

I am new to the world of UNIX scripting - and would like to make the following script: I have 100 files numbered 1-100. However - i would like to continue the file list - so that I add another 100 files following on, so that file 101 = 99; file 102 = 98 ; 103 = 97 and so on.... (basically ...... (6 Replies)
Discussion started by: AJC1985
6 Replies

9. UNIX for Dummies Questions & Answers

renumbering user id

Other than deleting and recreating a user can a users id number be changed? I need to have my user id the same on more than one system. (1 Reply)
Discussion started by: thumper
1 Replies
Login or Register to Ask a Question