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
 

 

Problem with SELCOPY

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> All Other Mainframe Topics
View previous topic :: :: View next topic  
Author Message
swapnil781

New User


Joined: 29 Jul 2009
Posts: 10
Location: Bangalore

PostPosted: Mon Sep 30, 2013 3:39 pm    Post subject: Sorting using SELCOPY
Reply with quote

Hi,
I have a FILE1 with LRECL = 3445 (FB),
As per my requirements I need to Select fields and need to create a new file with LRECL = 2805. I am able to do this using SORT but as per my requirment I need to implement this task using SELCOPY.

Sort card to change the LRECL to 2805:
SORT FIELDS=COPY
INREC FIELDS=(1:1,1729,45X,1775:1731,271,2046:2004,448,
2494:2458,248,2742:3102,30,2772:3214,1,
2773:3337,18,2791:3428,15)

Similarly SELCOPY to implement the above sort functionality

READ INFILE NORDW
IF EOF INFILE
THEN EOJ
MOVE 1729 FROM 1 TO 1
THEN POS 1730,1774 = X'40'
THEN MOVE 271 FROM 1731 TO 1775
THEN MOVE 448 FROM 2004 TO 2046
THEN MOVE 248 FROM 2458 TO 2494


THEN MOVE 030 FROM 3102 TO 2742
THEN MOVE 001 FROM 3214 TO 2772
THEN MOVE 018 FROM 3337 TO 2773
THEN MOVE 015 FROM 3428 TO 2791
WRITE OUTFILE


When I try to implement this using SELCOPY, then fields from lenth 2046 - 2494 are appearing as Blank, however the data is populated correctly to first 1729 bytes and later 2742 onwards. I believe this is due to the Spaces which are been indroduced from POS 1730,1774.
Can you please help me with this.

Thanks in advance.

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

David Robinson

Active User


Joined: 21 Dec 2011
Posts: 175
Location: UK

PostPosted: Mon Sep 30, 2013 4:19 pm    Post subject:
Reply with quote

If you can do it with SORT, why on earth do you want to change it to SELCOPY?

SELCOPY is a great product, but SORT will me far, far more efficient.
Back to top
View user's profile Send private message
swapnil781

New User


Joined: 29 Jul 2009
Posts: 10
Location: Bangalore

PostPosted: Mon Sep 30, 2013 6:59 pm    Post subject:
Reply with quote

Hi David,
Thanks for your message.

I do understand Sort is more efficient then SELCOPY, but due to Requirement criteria we are bounded to use SELCOPY. The support team is insisting to Implement SELCOPY.

Hope you could help me with the solution.


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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Mon Sep 30, 2013 8:01 pm    Post subject: Reply to: Problem with SELCOPY
Reply with quote

I don't know SELCOPY. Does these "overlap"?

Code:
THEN MOVE 448 FROM 2004 TO 2046


If so, every single byte from 2046 for the remainder of the 448 bytes will have the value of the byte which first causes the overlap.

If your Support people are so keen on SELCOPY, they should have been able to tell you this, and tell you how to fix it.

If this is not the problem, get them to locate it and suggest a fix anyway. There is a lot of SORT experience here, but an unknown-but-small amount of SELCOPY.
Back to top
View user's profile Send private message
swapnil781

New User


Joined: 29 Jul 2009
Posts: 10
Location: Bangalore

PostPosted: Mon Sep 30, 2013 11:18 pm    Post subject:
Reply with quote

Hi Bill,

Thanks for your Message.

There is no overlap from 2046, but after moving spaces from 1730 to 1774 (45 bytes), spaces are followed till 2494, But from 2742 onwards data is populated correctly.

Being into new assignment people are not much aware for Selcopy at myside, Thats is why I took help of this forum. I am trying to fix this at my end but chances are bleak.
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1738
Location: Bloomington, IL

PostPosted: Mon Sep 30, 2013 11:29 pm    Post subject:
Reply with quote

Is not the SELCOPY documentation freely downloadable from Compute (Bridgend)?
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Mon Sep 30, 2013 11:31 pm    Post subject: Reply to: Problem with SELCOPY
Reply with quote

Well, if you are sure.

In your SORT control cards, if you changed your FIELDS (which would have been better as BUILD) to an OVERLAY, you would get overlap and "propagation" of the overlapping part. If the bytes up to the overlap were space, then the entire result would be space no matter what is in position 2046 onwards originally.

Code:
THEN MOVE 448 FROM 2004 TO 2046


If 2004 and 2046 are within the same data area, you have an overlap, because 2004 for a length of 448 more than crashes into 2046.

If they are in different data areas (say 2004 in input area and 2046 in output area) then you do not have that problem.

Anyway, your Support people are more familiar with SELCOPY than we are.
Back to top
View user's profile Send private message
Nick Jones

New User


Joined: 28 Apr 2009
Posts: 13
Location: UK

PostPosted: Tue Oct 01, 2013 4:30 am    Post subject: Reply to: Problem with SELCOPY
Reply with quote

Beware that SELCOPY does indeed perform data propagation on an overlapped MOVE from a source position which is at a lower address than that of the destination position. e.g.

Code:
POS 1 = 'ABCDEFGHIJ'
MOVE 6 FROM 1 TO 3    * POS 1 will become 'ABABABABIJ'


To avoid propagation, you should define a work buffer and build the output record data in a different location to the input record. Also use EQUate statements to assign meaningful names to these areas. i.e.

Code:
EQU  INREC      1    * Buffer Input record position.
EQU  OUTREC  5001    * Buffer Output record position.

OPTION WORKLEN=10000    * Define a work buffer.

READ INFILE   INTO INREC  NORDW

MOVE 1729 FROM INREC+0000 TO OUTREC+0000

POS OUTREC+1729, OUTREC+1773 = X'40'      * 45 blanks.

MOVE  271 FROM INREC+1730 TO OUTREC+1774
MOVE  448 FROM INREC+2003 TO OUTREC+2045
MOVE  248 FROM INREC+2457 TO OUTREC+2493
MOVE  030 FROM INREC+3101 TO OUTREC+2741
MOVE  001 FROM INREC+3213 TO OUTREC+2771
MOVE  018 FROM INREC+3336 TO OUTREC+2772
MOVE  015 FROM INREC+3427 TO OUTREC+2790

WRITE OUTFILE  FROM OUTREC
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Tue Oct 01, 2013 4:37 am    Post subject: Reply to: Problem with SELCOPY
Reply with quote

Excellent Nick. thanks. Looks at least 200% nicer than the original.

I hope TS's Support people don't feel that now it is so much simpler and easier, that it is too complicated for them to understand...
Back to top
View user's profile Send private message
swapnil781

New User


Joined: 29 Jul 2009
Posts: 10
Location: Bangalore

PostPosted: Wed Oct 02, 2013 2:05 pm    Post subject: Reply to: Problem with SELCOPY
Reply with quote

Excellent Nick. Thanks it is working now.

Many Thanks to all for providing your inputs.
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 -> All Other Mainframe Topics All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Problem in writing Output file vickey_dw COBOL Programming 5 Mon Nov 14, 2016 11:14 pm
No new posts Problem in Running Query via JCL vickey_dw DB2 3 Tue Oct 18, 2016 11:11 pm
No new posts DB2 Streaming Batch Processing Problem Manshadi DB2 4 Sat Sep 24, 2016 12:14 pm
No new posts Problem with GETMAIN command amitc23 CICS 6 Thu Sep 01, 2016 1:01 pm
No new posts TXT2PDF problem - printing @ in PDF vipul65 All Other Mainframe Topics 9 Thu Aug 25, 2016 12:48 am


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