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

Writing the new counter file to another file?


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

New User


Joined: 04 Jun 2008
Posts: 36
Location: Chennai

PostPosted: Mon Oct 06, 2008 8:43 pm
Reply with quote

Hi,

I caught with this case in production..

I have to introduce one DFSORT step in my production JCL, which reads the counter file from the latest GDG and writes to +1 of the same GDG after adding +1with the counter file ...

Ex:
My input file has just one line as below:
Code:
20081006_____000005000*counter


Output file:
Code:
20081006_____000005001*counter


counter file starts from the 17theh position . record format is VB of length 80.

Thanks,
Guru.
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Mon Oct 06, 2008 10:12 pm
Reply with quote

Below is the code will work for you..
Just use sortin as current GDG
and sortout as (+1) generation
Code:

//SORTIN DD *                                                 
20081006_____000005000                                         
/*                                                             
//SORTOUT DD SYSOUT=*                                         
//SYSIN    DD    *                                             
   OPTION COPY                                                 
   INREC OVERLAY=(1,13,14,9,C'01')                             
   OUTREC FIELDS=(1,13,(14,9,ZD,ADD,23,02,ZD),EDIT=(TTTTTTTTT))
/*                                                             
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Mon Oct 06, 2008 10:39 pm
Reply with quote

Guru,

Sambhaji's control statements are more complex than they need to be.

Here are the DFSORT control statements you need:

Code:

  OPTION COPY                                       
  INREC OVERLAY=(14:14,9,ZD,ADD,+1,TO=ZD,LENGTH=9)   
Back to top
View user's profile Send private message
Guru Prasath

New User


Joined: 04 Jun 2008
Posts: 36
Location: Chennai

PostPosted: Tue Oct 07, 2008 10:15 am
Reply with quote

Hi Frank,

I have tried your solution, but what i got in the output as shown below, instead of getting 4508 , i got 450I . i tried with input 4508, that time i got 450H. Please let me know , whats wrong with this?
input :
Code:
 
----+----1----+----2----+----3---
2008100702071006000004507*COUNTER


output:
Code:
 
----+----1----+----2----+----3---
200810070207100600000450H*COUNTER


Hi Sambhaji,

Your solution is adding the counter perfectly. But i am loosing the rest of fields after the counter and i am getting low-values in that, instead of spaces. Please let me know, how to correct it?

Code:
 
----+----1----+----2----+----3---
2008100702071006000004508...................................
[/code]

One more thing, my counter position starts at 17th position of length 9.

Thanks,
Guru.
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Tue Oct 07, 2008 11:29 am
Reply with quote

Quote:

But i am loosing the rest of fields after the counter and i am getting low-values in that, instead of spaces. Please let me know, how to correct it?

Guru. Can you post your sortcard? and sortin

Quote:
Sambhaji's control statements are more complex than they need to be.

Yes definately Frank, I couldnt thought of your solution at that point of time. icon_sad.gif icon_sad.gif
Back to top
View user's profile Send private message
Guru Prasath

New User


Joined: 04 Jun 2008
Posts: 36
Location: Chennai

PostPosted: Tue Oct 07, 2008 11:37 am
Reply with quote

Sambahji,

here is my sort card,

Code:
                                                     
     OPTION COPY                                                     
     INREC OVERLAY=(1,16,17,9,C'01')                               
     OUTREC FIELDS=(1,16,(17,9,ZD,ADD,26,02,ZD),EDIT=(TTTTTTTTT)) 
 


Sort in (as given below):
Code:
 
----+----1----+----2----+----3---
2008100702071006000004507*COUNTER
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Tue Oct 07, 2008 11:48 am
Reply with quote

Its looking like your length is 33
so inrec should be modified to
INREC OVERLAY=(1,33,34:C'01')
and OUTREC will be

OUTREC FIELDS=(1,16,(17,9,ZD,ADD,34,02,ZD),EDIT=(TTTTTTTTT),26,8)
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Tue Oct 07, 2008 11:55 am
Reply with quote

Also it should work perfectly fine with solution given by Frank also,
Code:

   INREC OVERLAY=(17:17,9,ZD,ADD,+1,TO=ZD,LENGTH=9)
Back to top
View user's profile Send private message
Guru Prasath

New User


Joined: 04 Jun 2008
Posts: 36
Location: Chennai

PostPosted: Tue Oct 07, 2008 12:22 pm
Reply with quote

Sambhaji,

here is my edited sort card:

Code:
 
OPTION COPY                                                           
   INREC OVERLAY=(1,49,50:C'01')                                       
   OUTREC FIELDS=(1,16,(17,9,ZD,ADD,50,02,ZD),EDIT=(TTTTTTTTT),26,24)


Why i made changes to this is till 49 position i have some values. I can able to retain the values till that position. But after that i am getting LOW-VALUES , which i don't want. (from 50th to 80)

output:
Code:
 
----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
2008100702071006000004508*0000COUNTER in sequence............................       


Please help me in removing the low values?

Also, as i told early , i have tried frank's solution but i am getting characters in the last field. (ex 450I or 450H )

Thanks,
Guru
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Tue Oct 07, 2008 12:25 pm
Reply with quote

What is LRECL of your file?
Code:

INREC OVERLAY=(1,49,[i](here you should use lrecl+1)[/i]:C'01')
Back to top
View user's profile Send private message
Guru Prasath

New User


Joined: 04 Jun 2008
Posts: 36
Location: Chennai

PostPosted: Tue Oct 07, 2008 12:30 pm
Reply with quote

No,

i have tried that. it's throwing S0C7 error.

INREC OVERLAY=(1,49,81:C'01')

is there any way to removing the low-values?
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Tue Oct 07, 2008 12:30 pm
Reply with quote

Quote:
also, as i told early , i have tried frank's solution but i am getting characters in the last field. (ex 450I or 450H )


usually people having issues with Frank' solution have not described properly their problem icon_mad.gif

You should review Your understanding of zoned number representation ...
the 450i and 450h are the signed zoned decimal representation
with a proper high nibble sign c/f for positive d for negative
c being the preferred nibble as in this case

Code:
450i = "f4f5f0c9"x  which means a positive 4509
450h = "f4f5f0c8"x which means a positive 4508

so after all what You see are not chars in se but the representation of a signed digit
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Tue Oct 07, 2008 12:32 pm
Reply with quote

Post your whole step here..
Back to top
View user's profile Send private message
Guru Prasath

New User


Joined: 04 Jun 2008
Posts: 36
Location: Chennai

PostPosted: Tue Oct 07, 2008 12:45 pm
Reply with quote

Hi enrico,


Yes, i understood the problem, which you explained.

Could you provide me the solution , how to fix this problem? Please help me in fixing this?icon_redface.gif

Sambhaji,

Code:
                                           
//SORTIN   DD DSN=my.gdg(0),DISP=SHR                   
//SORTOUT  DD DSN=my.gdg(+1),                         
//          DISP=(NEW,CATLG,CATLG),                                     
//          UNIT=SYSDA,SPACE=(TRK,(5,1),RLSE),                         
//          DCB=(RECFM=FB,LRECL=80,BLKSIZE=0)                           
//SYSIN    DD *                                                         
  OPTION COPY                                                           
     INREC OVERLAY=(1,49,81:C'01')                                     
     OUTREC FIELDS=(1,16,(17,9,ZD,ADD,50,02,ZD),EDIT=(TTTTTTTTT),26,24)                                   
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Tue Oct 07, 2008 12:49 pm
Reply with quote

Quote:

//SYSIN DD *
OPTION COPY
INREC OVERLAY=(1,49,81:C'01')
OUTREC FIELDS=(1,16,(17,9,ZD,ADD,50,02,ZD),EDIT=(TTTTTTTTT),26,24)

part in bold should be 81,2,ZD

You are gettinh SOC7 bz at 50,2 there is no number
Back to top
View user's profile Send private message
Guru Prasath

New User


Joined: 04 Jun 2008
Posts: 36
Location: Chennai

PostPosted: Tue Oct 07, 2008 12:57 pm
Reply with quote

Hi Enrico,

Sorry for my poor understanding..

I have tried the below one. i just changed to ZDF and it worked fine.

INREC OVERLAY=(17:17,9,ZD,ADD,+1,TO=ZDF,LENGTH=9)
Back to top
View user's profile Send private message
Guru Prasath

New User


Joined: 04 Jun 2008
Posts: 36
Location: Chennai

PostPosted: Tue Oct 07, 2008 12:58 pm
Reply with quote

Sambhaji,

As you suggested, i have changed that to 81. this time the job went fine but still i am getting the low-values from 50 to 80th position.

Thanks,
Guru
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Tue Oct 07, 2008 2:17 pm
Reply with quote

Quote:

As you suggested, i have changed that to 81. this time the job went fine

Good to know that you have come out of SOC7
Quote:

but still i am getting the low-values from 50 to 80th position.

That is because you are only writing 49 char in output. You have to write all 80 chars.
as below
INREC OVERLAY=(1,49,81:C'01')
OUTREC FIELDS=(1,16,(17,9,ZD,ADD,81,02,ZD),EDIT=(TTTTTTTTT),26,55)
Back to top
View user's profile Send private message
Guru Prasath

New User


Joined: 04 Jun 2008
Posts: 36
Location: Chennai

PostPosted: Tue Oct 07, 2008 2:43 pm
Reply with quote

Sorry Sambhaji,

As suggested, i have tried but the result is same. Still i am getting low-values.

One more thing, as i told i have modified Frank's sort card as:

INREC OVERLAY=(17:17,9,ZD,ADD,+1,TO=ZDF,LENGTH=9)

this also gives low-values.

Thanks,
Guru
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Tue Oct 07, 2008 3:11 pm
Reply with quote

That means your input file itself has low values...
If you want spaces you have to put spaces explicitly like

OUTREC FIELDS=(1,16,(17,9,ZD,ADD,81,02,ZD),EDIT=(TTTTTTTTT),26,8,47X)

here i have assumed that you have valid 8 char data after counter and you want spaces after that till 80th column.
Back to top
View user's profile Send private message
Guru Prasath

New User


Joined: 04 Jun 2008
Posts: 36
Location: Chennai

PostPosted: Tue Oct 07, 2008 3:42 pm
Reply with quote

Yes sambhaji,

Your previous solutions itself solved worked fine.

It just accumulated from your previous solutions.

Also, Frank's solution too worked fine.

Thanks for all your effort.

Thanks,
Guru.
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Tue Oct 07, 2008 3:55 pm
Reply with quote

Guru,

Did you notice that Frank's solution did not pad the input file at the end whereas Sambaji's solution did. Padding at the end should NOT be done for VB files. By doing so one's just ignoring the very purpose of using a VB file.
Back to top
View user's profile Send private message
Guru Prasath

New User


Joined: 04 Jun 2008
Posts: 36
Location: Chennai

PostPosted: Tue Oct 07, 2008 4:36 pm
Reply with quote

Arun,

Are you talking about my input file? its FB...Not VB
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Tue Oct 07, 2008 4:52 pm
Reply with quote

Guru Prasath wrote:
Hi,

I caught with this case in production..
.............................
.............................
counter file starts from the 17theh position . record format is VB of length 80.

Thanks,
Guru.

This is what your initial post says. This topic has grown to the next page and you never mentioned your requirement got changed !!!. I believe these are some of the critical info. that you should mention clearly.
Back to top
View user's profile Send private message
Guru Prasath

New User


Joined: 04 Jun 2008
Posts: 36
Location: Chennai

PostPosted: Tue Oct 07, 2008 5:02 pm
Reply with quote

Yes,

this is my mistake. So many i read the post...i dont know how i missed it?

sorry again.

Thanks for pointing this.

This will not happen again.
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 Goto page 1, 2  Next

 


Similar Topics
Topic Forum Replies
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 1
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
Search our Forums:

Back to Top