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
 

 

How to write records in reverse order ?

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

New User


Joined: 13 Nov 2005
Posts: 2
Location: dubai

PostPosted: Sun May 07, 2006 11:20 am    Post subject: How to write records in reverse order ?
Reply with quote

I have a Physical sequential file with 10 records.

I want to copy all these records into another ps fille in the reverse order (last record should be first record in the new file).

IS IT POSSIBLE ? HOW ????
Back to top
View user's profile Send private message

Frank Yaeger

DFSORT Moderator


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

PostPosted: Sun May 07, 2006 8:10 pm    Post subject:
Reply with quote

What is the RECFM and LRECL of your input file?
Back to top
View user's profile Send private message
dneufarth

Active User


Joined: 27 Apr 2005
Posts: 241
Location: Cincinnati OH USA

PostPosted: Sun May 07, 2006 9:21 pm    Post subject:
Reply with quote

with SORT all things are possible!

can't copy, but you can sort in descending sequence


Read The Fine Manual
Back to top
View user's profile Send private message
jackal
Currently Banned

New User


Joined: 21 Jan 2006
Posts: 48
Location: india

PostPosted: Mon May 08, 2006 11:02 am    Post subject: copy
Reply with quote

hi all,
u cannot copy or write records in reverse order but u can sort u can write records in reverse order in CICS only using read previous.
Back to top
View user's profile Send private message
shrivatsa
Warnings : 1

Active User


Joined: 17 Mar 2006
Posts: 171
Location: Bangalore

PostPosted: Mon May 08, 2006 2:02 pm    Post subject:
Reply with quote

Hi Jeeson,

R U Intrested to do it in FOCUS?

Please let me know if you can able to understand the FOCUS
Back to top
View user's profile Send private message
IQofaGerbil

Active User


Joined: 05 May 2006
Posts: 183
Location: Scotland

PostPosted: Mon May 08, 2006 3:26 pm    Post subject: Re: How to write records in reverse order ?
Reply with quote

This is really contrived but if you must, then here is one way!


//ICE1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//REPORT DD SYSOUT=*
//*
//IN001 DD DSN=YYYY.IN1,
// DISP=SHR
//TOOLIN DD *
COPY FROM(IN001) TO(OUT001) USING(S001)
COPY FROM(IN001) TO(OUT001) USING(S002)
COPY FROM(IN001) TO(OUT001) USING(S003)
COPY FROM(IN001) TO(OUT001) USING(S004)
COPY FROM(IN001) TO(OUT001) USING(S005)
COPY FROM(IN001) TO(OUT001) USING(S006)
COPY FROM(IN001) TO(OUT001) USING(S007)
COPY FROM(IN001) TO(OUT001) USING(S008)
COPY FROM(IN001) TO(OUT001) USING(S009)
COPY FROM(IN001) TO(OUT001) USING(S010)
/*
//S001CNTL DD *
SORT FIELDS=COPY,SKIPREC=0000009,STOPAFT=00001
//S002CNTL DD *
SORT FIELDS=COPY,SKIPREC=0000008,STOPAFT=00001
//S003CNTL DD *
SORT FIELDS=COPY,SKIPREC=0000007,STOPAFT=00001
//S004CNTL DD *
SORT FIELDS=COPY,SKIPREC=0000006,STOPAFT=00001
//S005CNTL DD *
SORT FIELDS=COPY,SKIPREC=0000005,STOPAFT=00001
//S006CNTL DD *
SORT FIELDS=COPY,SKIPREC=0000004,STOPAFT=00001
//S007CNTL DD *
SORT FIELDS=COPY,SKIPREC=0000003,STOPAFT=00001
//S008CNTL DD *
SORT FIELDS=COPY,SKIPREC=0000002,STOPAFT=00001
//S009CNTL DD *
SORT FIELDS=COPY,SKIPREC=0000001,STOPAFT=00001
//S010CNTL DD *
SORT FIELDS=COPY,STOPAFT=00001
//OUT001 DD DSN=YYYY.OU1,DISP=MOD
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


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

PostPosted: Mon May 08, 2006 8:51 pm    Post subject:
Reply with quote

Well, no answer to my question about the RECFM and LRECL, so I'll just assume it's FB/80. Here's a DFSORT job that will reverse any number of records in one pass. It can be changed appropriately for other attributes.

Code:

//S1    EXEC  PGM=ICEMAN                     
//SYSOUT    DD  SYSOUT=*                     
//SORTDIAG  DD  DUMMY                       
//SORTIN DD DSN=...  input file (FB/80)                               
//SORTOUT DD DSN=...  output file (FB/80)                       
//SYSIN    DD    *                           
* Add seqnum.
  INREC OVERLAY=(81:SEQNUM,8,ZD)             
* Sort on seqnum descending.
  SORT FIELDS=(81,8,ZD,D)   
* Remove seqnum.                 
  OUTREC BUILD=(1,80)                         
/*
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 Join giving more records than expected Danielle.Filteau SYNCSORT 2 Thu Mar 09, 2017 3:28 am
No new posts TSO or command line utility to genera... kishpra JCL & VSAM 3 Thu Mar 09, 2017 1:11 am
No new posts Extract set of records matching on ac... bhaskar_kanteti DFSORT/ICETOOL 3 Mon Mar 06, 2017 7:19 am
No new posts Write R1 and R2 to OP1 and R1 to OP2 bhaskar_kanteti DFSORT/ICETOOL 10 Fri Mar 03, 2017 11:18 am
No new posts Can you write 2 recs on SORTOUT when ... Sysaron DFSORT/ICETOOL 6 Thu Feb 23, 2017 12:07 am


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