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

Is it good to do the above task using SYNCSORT or COBOL


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
kbmkris

Active User


Joined: 24 Jun 2006
Posts: 101

PostPosted: Thu May 31, 2007 10:01 am
Reply with quote

Hi,

I am having a file with say n fields of which I have a field with a single alphabetic character. In the output file, I have to replace this alphabetic character with the corresponding number and with all the other fields remaining same. Could you please help me in doing this?

Moreover, my input file has millions of records. Whether it is good to do the above task using sort or COBOL program and which is efficient?

Thanks,
Bala
Back to top
View user's profile Send private message
muthuvel

Active User


Joined: 29 Nov 2005
Posts: 217
Location: Canada

PostPosted: Thu May 31, 2007 10:50 am
Reply with quote

If it is a single replacement for ex:whether it is "a" ,"b" or "c" you are going to replace by it one number say "5" then you can use sort with OUTREC option.
If it is a replacement of different numbers for different alphabets then COBOL is preferable.
In case of efficiency test both(COBOL and Sort) and see which consumes less CPU time or elapsed time.
Back to top
View user's profile Send private message
kbmkris

Active User


Joined: 24 Jun 2006
Posts: 101

PostPosted: Thu May 31, 2007 10:54 am
Reply with quote

Hi,

It is like replacing different alphabets with different numbers.
I would like to know whether this can be done by Syncsort. If so, could you let me know how to do that?

Thanks,
Bala
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Thu May 31, 2007 2:31 pm
Reply with quote

Like DFSort, Syncsort can convert characters. Look at the ALTSEQ and the TRAN parameters in your manual.
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Thu May 31, 2007 8:44 pm
Reply with quote

kbmkris wrote:
Hi,

I am having a file with say n fields of which I have a field with a single alphabetic character.

Bala


Bala,

Please let me know,
1. Is the file FB or VB ?
2. Do you know the position of that single alphabetic character.
3. Character position is static or varies.
Back to top
View user's profile Send private message
raak

Active User


Joined: 23 May 2006
Posts: 166
Location: chennai

PostPosted: Fri Jun 01, 2007 12:19 pm
Reply with quote

Hey,

With Syncsort use this.


Code:
OPTION COPY                             
ALTSEQ CODE=(D5E8)                 
INREC FIELDS=(1,3,4,1,TRAN=ALTSEQ,5,195)



here input is a 200 byte FB file.
I am changing the value 'N' in position 4 to 'Y'. ( D5 is the Hex code of N and E8 is the hex-code of Y)

If u want more values to be changed, u can give that in the ALTSEQ CODE line seperated by a comma.
Back to top
View user's profile Send private message
kbmkris

Active User


Joined: 24 Jun 2006
Posts: 101

PostPosted: Mon Jun 04, 2007 11:12 am
Reply with quote

Hi anuj,

I have to do the same thing in a FB file and in a VB file also. Yes, I know the position of the character i want to change and the character will vary.
For e.g.
in my input file, if position 4 is
'C' then i have to change it to '1'.
'A' then to '2'.
'D' then to '3' like that.

Thanks,
Bala
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Mon Jun 04, 2007 1:30 pm
Reply with quote

You can translate more than one character at a time:
ALTSEQ CODE=(F0B7,F1B8,F2B9,F3BA,F4BB,F5BC,F6BD,F7BE,F8BF,F9C0)

Have you checked your manual?
Back to top
View user's profile Send private message
kbmkris

Active User


Joined: 24 Jun 2006
Posts: 101

PostPosted: Mon Jun 04, 2007 2:30 pm
Reply with quote

hi William,

I am not sure how to formulate the corresponding hexcode for the alphabets. Please let me know how to find the corresponding hexcode for alphabets and numbers?

I went on checking with the previous Syncsort related posts in the forum and from that i came to know that some of the commands available in DFSORT will work in SYNCSORT also. I tried and it is working.

The code I used is
Code:
SORT FIELDS=COPY
    INREC IFTHEN=(WHEN=(9,1,CH,EQ,C'C'),OVERLAY=(9:C'1')


All, thanks for your help.

Thanks,
Bala
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Mon Jun 04, 2007 2:39 pm
Reply with quote

How many "IFTHEN" sort of substituions do you have? ONe for every letter in the alphabet? Or just a select few?
Back to top
View user's profile Send private message
kbmkris

Active User


Joined: 24 Jun 2006
Posts: 101

PostPosted: Mon Jun 04, 2007 2:44 pm
Reply with quote

Hi William,

i have to do that based on some condition, say, if my position 7 and 8 of my input file contains TT and the character is C at position 9, i have to replace it to 1. Similarly i have to do for 8 conditions. So i have totally 8 ifthen in my sortcard. The full sortcard i used is
Code:
SORT FIELDS=(1,6,PD,A,7,2,CH,A,9,1,CH,A)               
INREC IFTHEN=(WHEN=(7,2,CH,EQ,C'TT',AND,9,1,CH,EQ,C'C'),
              OVERLAY=(9:C'1')),                       
      IFTHEN=(WHEN=(7,2,CH,EQ,C'TT',AND,9,1,CH,EQ,C'F'),
              OVERLAY=(9:C'2')),                       
      IFTHEN=(WHEN=(7,2,CH,EQ,C'TT',AND,9,1,CH,EQ,C'I'),
              OVERLAY=(9:C'3')),                       
      IFTHEN=(WHEN=(7,2,CH,EQ,C'TT',AND,9,1,CH,EQ,C'M'),
              OVERLAY=(9:C'4')),                       
      IFTHEN=(WHEN=(7,2,CH,EQ,C'TT',AND,9,1,CH,EQ,C'L'),
              OVERLAY=(9:C'5')),                       
      IFTHEN=(WHEN=(7,2,CH,NE,C'TT',AND,9,1,CH,EQ,C' '),
              OVERLAY=(9:C'1')),                       
      IFTHEN=(WHEN=(7,2,CH,NE,C'TT',AND,9,1,CH,EQ,C'M'),
              OVERLAY=(9:C'2')),                       
      IFTHEN=(WHEN=(7,2,CH,NE,C'TT',AND,9,1,CH,EQ,C'L'),
              OVERLAY=(9:C'3'))                         


Thanks,
Bala
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Mon Jun 04, 2007 3:05 pm
Reply with quote

Looks like you got it, what's the problem?
Back to top
View user's profile Send private message
kbmkris

Active User


Joined: 24 Jun 2006
Posts: 101

PostPosted: Mon Jun 04, 2007 4:20 pm
Reply with quote

Hi William,

My input file contains 90000000 records. I want to know what i have to use. I have a COBOL program to do the same without sorted output and this JCL. Which is efficient? Could you please suggest me?

Thanks,
bala
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Mon Jun 04, 2007 4:26 pm
Reply with quote

I'd say, it's pretty much your choice.....
If you already have the COBOL program, why not run both and see which id more efficient?
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Wed Jun 06, 2007 8:38 pm
Reply with quote

Hi Bala,

Sorry I was away from net for some days, so could not check your reply.

By the way, I hope you got your answer icon_smile.gif .
Back to top
View user's profile Send private message
kbmkris

Active User


Joined: 24 Jun 2006
Posts: 101

PostPosted: Thu Jun 07, 2007 11:45 am
Reply with quote

hi Anuj,

Yes i got that. Thanks for your reply:-)
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Thu Jun 07, 2007 7:41 pm
Reply with quote

You are welcome. icon_smile.gif
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts COBOL ZOS Web Enablement Toolkit HTTP... COBOL Programming 0
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Calling DFSORT from Cobol, using OUTF... DFSORT/ICETOOL 5
Search our Forums:

Back to Top