Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Modifying only the last record using Syncsort

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
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    Post subject: Modifying only the last record using Syncsort
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10201
Location: italy

PostPosted: Wed Apr 29, 2009 5:06 pm    Post subject: Reply to: DELETING SELECTIVE RECORDS FROM A PDS USING SORT
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    Post subject:
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

Site Director


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

PostPosted: Wed Apr 29, 2009 9:01 pm    Post subject:
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    Post subject:
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

Site Director


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

PostPosted: Wed Apr 29, 2009 11:48 pm    Post subject:
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: 2150
Location: At my coffee table

PostPosted: Thu Apr 30, 2009 12:10 am    Post subject:
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    Post subject:
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    Post subject:
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    Post subject:
Reply with quote

HI,

http://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    Post subject:
Reply with quote

maheshvamsi wrote:
HI,

http://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

Site Director


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

PostPosted: Thu Apr 30, 2009 1:47 pm    Post subject: Reply to: Modifying only the last record using Syncsort
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: 2150
Location: At my coffee table

PostPosted: Thu Apr 30, 2009 2:11 pm    Post subject:
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    Post subject:
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: 8593
Location: Back in jolly old England

PostPosted: Thu Apr 30, 2009 4:35 pm    Post subject:
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: 2150
Location: At my coffee table

PostPosted: Thu Apr 30, 2009 5:24 pm    Post subject:
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    Post subject:
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: 2150
Location: At my coffee table

PostPosted: Thu Apr 30, 2009 8:17 pm    Post subject:
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

Site Director


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

PostPosted: Thu Apr 30, 2009 10:41 pm    Post subject: Reply to: Modifying only the last record using Syncsort
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    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts syncsort: copy lines after the keyword shreya19 SYNCSORT 1 Fri Dec 02, 2016 9:47 am
No new posts How to update a portion of text in a ... Bill Woodger DFSORT/ICETOOL 25 Wed Nov 09, 2016 9:41 pm
No new posts Syncsort - Hard coded Value in output PORYES SYNCSORT 1 Thu Nov 03, 2016 9:23 am
No new posts Syncsort - NULL in Integer field chec... nartcr SYNCSORT 4 Thu Oct 06, 2016 6:47 am
No new posts sort with previous record anatol DFSORT/ICETOOL 9 Thu Oct 06, 2016 2:36 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us