Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Format Last Record differently from rest of records

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
Learncoholic

New User


Joined: 20 Sep 2007
Posts: 88
Location: India

PostPosted: Tue Oct 24, 2017 12:01 pm    Post subject: Format Last Record differently from rest of records
Reply with quote

Hi,
I have a I/P file that reads:
Code:

            AAA
          AAAAA
         123145
      SCNCASHCJ


I want to have the O/P as:
Code:
'            AAA',
'          AAAAA',
'         123145',
'      SCNCASHCJ');


The No of records in the file may vary on a daily basis.

I did this is 2 SORT Steps. I would prefer to have it in 1 step.

I tried to do it in 1 step by using:
INREC - to provide Sequence Number
SORT - descending based on the Sequence No
OUTFIL IFTHEN - to build ');' in case Sequence No is 1 otherwise build ','.
This arrangement actually flips the records.

Can this be done without flipping using a single SORT Step?

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

sergeyken

Active User


Joined: 29 Apr 2008
Posts: 212
Location: Maryland

PostPosted: Tue Oct 24, 2017 5:53 pm    Post subject:
Reply with quote

At the first step, no info can be available in advance: what is following next to the current record?
This is fundamental principle; it is not related neither to SORT, nor to anything else.
Any possible trick would simulate the second scan of records, either explicitly, or in hidden manner.
Back to top
View user's profile Send private message
daveporcelan

Active Member


Joined: 01 Dec 2006
Posts: 687
Location: Pennsylvania

PostPosted: Tue Oct 24, 2017 8:01 pm    Post subject:
Reply with quote

Additional information would be helpful.

When the scope of the problem is too narrow, the possible solutions are limited.

The desired output appears to be part of SYSIN DD for some sort of SQL.

Please show the next step of the Job where this is to run.

I have a thought that could be helpful, but can not properly express without additional information.
Back to top
View user's profile Send private message
RahulG31

Active User


Joined: 20 Dec 2014
Posts: 408
Location: USA

PostPosted: Wed Oct 25, 2017 3:20 am    Post subject: Reply to: Format Last Record differently from rest of records
Reply with quote

As daveporcelan mentioned, if it is indeed a part of SQL query where you are doing something like a 'WHERE values IN' and trying to build the list of values then, you could possibly make use of a 'Dummy' record:
Code:
 OUTFIL BUILD=(1:X'7D',2:1,16,18:X'7D6B',X),
 TRAILER1=(1:X'7D',2:C'           DUMMY',18:X'7D5D5E')
 OPTION COPY


the output will be:
Code:
'             AAA',
'           AAAAA',
'          123145',
'       SCNCASHCJ',
'           DUMMY');

The 'Dummy' value won't make a difference to the output if chose carefully.

.
Back to top
View user's profile Send private message
Learncoholic

New User


Joined: 20 Sep 2007
Posts: 88
Location: India

PostPosted: Wed Oct 25, 2017 8:29 pm    Post subject:
Reply with quote

Hi Rahul & daveporcelan,

Both of you are correct. This O/P of the SORT is an I/P to a SQL Query.
I get what Rahul is suggesting & putting a Dummy record will work perfectly fine in my case.

Thanks
Back to top
View user's profile Send private message
daveporcelan

Active Member


Joined: 01 Dec 2006
Posts: 687
Location: Pennsylvania

PostPosted: Wed Oct 25, 2017 10:37 pm    Post subject:
Reply with quote

That is what I was going to suggest, but was waiting for you to provide more information.

Since you are 'learnaholic', learn this: providing some background information (do not go overboard), would greatly help get solutions to the problem.

Lucky for you, both Rahul and I have enough experience to work with the sparse information provided.
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 -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Extract Record using range of Data scorp_rahul23 DFSORT/ICETOOL 3 Wed Nov 15, 2017 11:54 pm
No new posts Squeeze record left so that zeroes ar... Vignesh Sid SYNCSORT 5 Fri Nov 10, 2017 1:40 pm
No new posts Increment number for every group of r... srajendran2 DFSORT/ICETOOL 7 Thu Nov 09, 2017 10:31 pm
No new posts Matching and unmatched records!! Vignesh Sid SYNCSORT 3 Thu Nov 09, 2017 11:22 am
No new posts Formatting multiple records to a sing... Vignesh Sid SYNCSORT 3 Tue Nov 07, 2017 12:22 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us