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

Modifying only the last record using Syncsort


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

New User


Joined: 14 Nov 2007
Posts: 70
Location: mumbai

PostPosted: Wed Apr 29, 2009 4:55 pm
Reply with quote

I need to delete a single record. So here is the description of the prob.

The PDS member contains more than 50,000 records, it's not fixed it can vary..but the dataset will contain huge number of records.

The data format is as below

{4: ABCDREKKKKKLLL -}..$
{4: ABCDREKKKKKLLL -}..$
{4: ABCDREKKKKKLLL -}..$
{4: ABCDREKKKKKLLL -}..$
{4: ABCDREKKKKKLLL -}..$


now my requirement is after the member is created for the last record I need to delete the $ (ONLY THE LAST ONE ) using SYNCSORT.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Wed Apr 29, 2009 5:06 pm
Reply with quote

Your post is very confusing...

are You dealing with a PDS ( partitioned dataset ) , or a PS

are You deleting a record, or are You simply reformatting the last record

the proper way to ask is to simply describe the problem/requirement
without specifying the tool

asking to do something with some <TOOL> implies that You have the competence
to evaluate the <TOOLS> available and make the <BEST> choice,
and You wouldn' t need to ask for help

please describe better Your requirements
Back to top
View user's profile Send private message
beruoist

New User


Joined: 14 Nov 2007
Posts: 70
Location: mumbai

PostPosted: Wed Apr 29, 2009 5:17 pm
Reply with quote

Sorry mistyped its a PS

Requirement:- I have created a Natural program for some BATCH PROCESSING.It reads a adabas file and writes a PS(Workfile).Now at the end of each record i have put $ as a seperator.Now this seperator will be written at the last record as well.
Since i do not want to do the changes to remove the last records $ seperator..because its called from other applications as well which needs a $ seperator at thier end.

So now i need to work this on the JCL.So what i need to do is to remove the $ seperator from the last record.

for example..my Program will write the records in below format in a workfile (PS)

{4: ABCDREKKKKKLLL -}..$
{4: ABCDREKKKKKLLL -}..$
{4: ABCDREKKKKKLLL -}..$
{4: ABCDREKKKKKLLL -}..$
{4: ABCDREKKKKKLLL -}..$

so for the last record i need to delete the $ seperator.

Please help

Thanks in ADVANCE
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Wed Apr 29, 2009 9:01 pm
Reply with quote

Hello,

Rather than waste a full pass of the data to "undo" the last delimiter, you could simply change the create program to write "one record behind".

Write the record with the $ ony when you know there is another. When the input is exausted, write the last record without the $.
Back to top
View user's profile Send private message
beruoist

New User


Joined: 14 Nov 2007
Posts: 70
Location: mumbai

PostPosted: Wed Apr 29, 2009 10:53 pm
Reply with quote

That is what i mentioned earlier........i do not do the modifications in the module due to its multiple usage..and some other limitations

Please advice how we can do this using an JCL step.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Wed Apr 29, 2009 11:48 pm
Reply with quote

Hello,

Quote:
i do not do the modifications in the module due to its multiple usage
Suggest this would easily be handled by a parm that tells the code whether to write or not write the "last" $.

As happens often, there is a desire to implement what is easiest for the programmer - especially if someone else is to actually do the work/provide the code. . .
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Thu Apr 30, 2009 12:10 am
Reply with quote

Unless WHEN=LAST has been added to Syncsort/tool, I can only see a two pass sort with sequence numbers.
Possibly a copy pass to a DD DUMMY that generates a control input to another copy pass with sequence number that the IFTHEN can work on the last record.
Back to top
View user's profile Send private message
beruoist

New User


Joined: 14 Nov 2007
Posts: 70
Location: mumbai

PostPosted: Thu Apr 30, 2009 10:19 am
Reply with quote

CICS Guy wrote:
Unless WHEN=LAST has been added to Syncsort/tool, I can only see a two pass sort with sequence numbers.
Possibly a copy pass to a DD DUMMY that generates a control input to another copy pass with sequence number that the IFTHEN can work on the last record.


CICS GUY..can you please post a sample code for this.

Many thanks
Beruoist
Back to top
View user's profile Send private message
beruoist

New User


Joined: 14 Nov 2007
Posts: 70
Location: mumbai

PostPosted: Thu Apr 30, 2009 11:23 am
Reply with quote

can anyone help me on this please ??
Back to top
View user's profile Send private message
maheshvamsi

New User


Joined: 22 Mar 2008
Posts: 39
Location: bangalore

PostPosted: Thu Apr 30, 2009 11:44 am
Reply with quote

HI,

ibmmainframes.com/viewtopic.php?t=26257&start=0&postdays=0&postorder=asc&highlight=remove+trailer

try using the solution given in the post, I tried it using synsort. It was working.
Back to top
View user's profile Send private message
beruoist

New User


Joined: 14 Nov 2007
Posts: 70
Location: mumbai

PostPosted: Thu Apr 30, 2009 1:25 pm
Reply with quote

maheshvamsi wrote:
HI,

ibmmainframes.com/viewtopic.php?t=26257&start=0&postdays=0&postorder=asc&highlight=remove+trailer

try using the solution given in the post, I tried it using synsort. It was working.


Help required

INPUT

Code:


{4: ABCDREKKKKKLLLsdsd -}..$
{4: ABCDREKKKKKLLLasdadsdf -}..$
{4: ABCDREKKKKK -}..$
{4: ABCDREKKKKKasdasdqwrqrqwdLLL -}..$
{4: ABCDREKKKKKLadsasfefLL -}..$




OUTPUT

Code:

{4: ABCDREKKKKKLLLsdsd -}..$
{4: ABCDREKKKKKLLLasdadsdf -}..$
{4: ABCDREKKKKK -}..$
{4: ABCDREKKKKKasdasdqwrqrqwdLLL -}..$
{4: ABCDREKKKKKLadsasfefLL -}..


Dollar at the last record needs to be removed,Please post the JCL code...i am very new to JCL
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Thu Apr 30, 2009 1:47 pm
Reply with quote

Do not double post - the duplicate has been deleted.

If you had gone ahead and modified/written the code yesterday, you would be done now. . .

d
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Thu Apr 30, 2009 2:11 pm
Reply with quote

beruoist wrote:
CICS GUY..can you please post a sample code for this.
Did you look at maheshvamsi's How to remove the trailer record from the File?
Frank's first suggested code seems to be a good sample of how to do what you want.
Back to top
View user's profile Send private message
beruoist

New User


Joined: 14 Nov 2007
Posts: 70
Location: mumbai

PostPosted: Thu Apr 30, 2009 4:33 pm
Reply with quote

what changes i wll require to do for my requirement in the below JCL code

Code:



//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input file (FB/80)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//SYM DD DSN=&&S1,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)
//SYSIN    DD    *
  OPTION COPY
  OUTFIL FNAMES=T1,OVERLAY=(81:SEQNUM,8,ZD)
  OUTFIL FNAMES=SYM,REMOVECC,NODETAIL,
    TRAILER1=('LASTREC,+',COUNT=(M11,LENGTH=8),80:X)
//S2  EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SYMNAMES DD DSN=&&S1,DISP=(OLD,PASS)
//SORTIN DD DSN=&&T1,DISP=(OLD,PASS)
//OUT DD DSN=...  output file (FB/80)
//SYSIN    DD    *
  SORT FIELDS=COPY
  OUTFIL FNAMES=OUT,
    OMIT=(81,8,ZD,EQ,LASTREC),
    BUILD=(1,80)
/*



Please advice i am a noob in JCL

Thanks in advance
Beruoist
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Thu Apr 30, 2009 4:35 pm
Reply with quote

What happened when you tried it for yourself ?
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Thu Apr 30, 2009 5:24 pm
Reply with quote

beruoist wrote:
what changes i wll require to do for my requirement in the below JCL code
OK, if you knew that there was exactally five records in your file and each had a sequence number such as
Code:
{4: ABCDREKKKKKLLL -}..$ 000000001
{4: ABCDREKKKKKLLL -}..$ 000000002
{4: ABCDREKKKKKLLL -}..$ 000000003
{4: ABCDREKKKKKLLL -}..$ 000000004
{4: ABCDREKKKKKLLL -}..$ 000000005

How would you modify the last record? Something like:
Code:
 IFTHEN=(WHEN=(cc,len,ZD,EQ,+000000005),OVERLAY=(cc:C' '))

Right? Then you would need another WHEN for everything else, right?
So a simple copy of the above data would get you what you want, right?
Back to top
View user's profile Send private message
beruoist

New User


Joined: 14 Nov 2007
Posts: 70
Location: mumbai

PostPosted: Thu Apr 30, 2009 8:07 pm
Reply with quote

CICS Guy wrote:
beruoist wrote:
what changes i wll require to do for my requirement in the below JCL code
OK, if you knew that there was exactally five records in your file and each had a sequence number such as
Code:
{4: ABCDREKKKKKLLL -}..$ 000000001
{4: ABCDREKKKKKLLL -}..$ 000000002
{4: ABCDREKKKKKLLL -}..$ 000000003
{4: ABCDREKKKKKLLL -}..$ 000000004
{4: ABCDREKKKKKLLL -}..$ 000000005

How would you modify the last record? Something like:
Code:
 IFTHEN=(WHEN=(cc,len,ZD,EQ,+000000005),OVERLAY=(cc:C' '))

Right? Then you would need another WHEN for everything else, right?
So a simple copy of the above data would get you what you want, right?


my will always contain 50000+ or 50000- records ...the number of records arent fixed.In that case how we will find and modify the last record.

Complete JCL will be very helpful.

Thank you very much
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Thu Apr 30, 2009 8:17 pm
Reply with quote

Quote:
Complete JCL will be very helpful.

I am not going to write this, I'm trying to show you how to get what you want. You need to do the writing.
Try it, you may learn something.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Thu Apr 30, 2009 10:41 pm
Reply with quote

Still "fritterin'" away time to implement something that requires a complete copy of the entire file. . .

Gee, just like is done on the Winboxes that have so many performance problems. . .

Rather pathetic - but probably good for cpu and dasd sales. . .

d
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 How to split large record length file... DFSORT/ICETOOL 10
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts FINDREP - Only first record from give... DFSORT/ICETOOL 3
No new posts Compare only first records of the fil... SYNCSORT 7
Search our Forums:

Back to Top